-->

Error Domain=kAFAssistantErrorDomain Code=209 “(nu

2020-08-14 10:32发布

问题:

I am facing an issue with the SFSpeechRecognizer. After few seconds of starting the application I start getting the error

Error Domain=kAFAssistantErrorDomain Code=209 "(null)"" and "Error Domain=kAFAssistantErrorDomain Code=203 "Timeout" UserInfo={NSLocalizedDescription=Timeout, NSUnderlyingError=0x170049990 {Error Domain=SiriSpeechErrorDomain Code=100 "(null)"}}

and the application stops recognization.

I am trying to endAudio() and then again start it every 20 seconds as Apple does not allow us to recognize for more than a minute.

Any help regarding this will really be appreciated.

回答1:

This work for me. Try this when you want to close the recognitiontask:

DispatchQueue.main.async { [unowned self] in
        guard let task = self.recognitionTask else {
            fatalError("Error")
        }
        task.cancel()
        task.finish()
    }