iOS 10.0 Speech Recognition Error kAFAssistantErrorDomain

♀尐吖头ヾ 提交于 2019-12-05 05:59:53

I have the same error, but identical code worked fine on device. So, install iOS 10 beta on a physical device and run your code. Something like this ought to do the trick:

SFSpeechRecognizer.requestAuthorization { authStatus in
    if authStatus == SFSpeechRecognizerAuthorizationStatus.authorized {
        if let path = Bundle.main().urlForResource("test", withExtension: "m4a") {
            let recognizer = SFSpeechRecognizer()
            let request = SFSpeechURLRecognitionRequest(url: path)
            recognizer?.recognitionTask(with: request, resultHandler: { (result, error) in
                if let error = error {
                    print("There was an error: \(error)")
                } else {
                    print (result?.bestTranscription.formattedString)
                }
            })
        }
    }
}

I wrote about this in more detail here.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!