首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >SFSpeechRecognizer失败,出现错误Domain=kAFAssistantErrorDomain Code=1700 on Ipad

SFSpeechRecognizer失败,出现错误Domain=kAFAssistantErrorDomain Code=1700 on Ipad
EN

Stack Overflow用户
提问于 2020-05-19 00:52:55
回答 1查看 455关注 0票数 0

我有一个奇怪的bug,它只出现在iPad物理设备上,在iPhone物理设备上,所有的iPad模拟器都工作得很好,但在iPad物理设备上,我得到了Error Domain=kAFAssistantErrorDomain Code=1700。这怎么会发生呢?

我的SFSpeechRecognizer代码:

代码语言:javascript
运行
复制
func requestTranscribePermissions() {
    SFSpeechRecognizer.requestAuthorization { [unowned self] authStatus in
        DispatchQueue.main.async {
            if authStatus == .authorized {
                print("Good to go!")
            } else {
                print("Transcription permission was declined.")
            }
        }
    }
}


func convertAudioToText() {
            if let file = audio {
            print(file)

            let recognizer = SFSpeechRecognizer(locale: Locale(identifier: "en-US"))
            let request = SFSpeechURLRecognitionRequest(url: file)

                request.shouldReportPartialResults = false

                if (recognizer?.isAvailable)! {

                    recognizer?.recognitionTask(with: request) { result, error in
                        guard error == nil else { print("Error: \(error!)"); return }
                        guard let result = result else { print("No result!"); return }

                        self.text = result.bestTranscription.formattedString
                        self.performSegue(withIdentifier: "Convert", sender: nil)

                        print(result.bestTranscription.formattedString)
                    }
                } else {
                    print("Device doesn't support speech recognition")
                }
        } else {
            let alert = UIAlertController(title: "There's no audio", message: "No audio recorded", preferredStyle: .alert)
            alert.addAction(UIAlertAction(title: NSLocalizedString("OK", comment: "Default action"), style: .default, handler: { _ in
            NSLog("The \"OK\" alert occured.")
            }))
            self.present(alert, animated: true, completion: nil)

        }

}

只有在iPad物理设备上我才能得到:

Utility +AFAggregator logDictationFailedWithError: Error Domain=kAFAssistantErrorDomain Code=1700 "(null)“Error: Error Domain=kAFAssistantErrorDomain Code=1700 "(null)”

EN

回答 1

Stack Overflow用户

发布于 2020-06-04 09:30:07

我在我的应用程序中也遇到了同样的错误。将我的iphone从iOS 13.4.2更新到13.5.1,将XCode更新到11.5,这个错误已经修复。希望这能有所帮助。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61874811

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档