小编use*_*082的帖子

SFSpeechRecognizer kAFAssistantErrorDomain Code=203“重试”

我使用 SFSpeechRecognizer,基本上可以工作。

1.但有时会出现以下错误。并且主要是在我没有执行之前avStop()

[Utility] +[AFAggregator logDictationFailedWithError:] Error Domain=kAFAssistantErrorDomain Code=203 "Retry" UserInfo={NSLocalizedDescription=Retry, NSUnderlyingError=0x1c464b880 {Error Domain=SiriSpeechErrorDomain Code=1 "(null)"}}

2.并且完全无法后台工作,会产生如下错误。

[Utility] +[AFAggregator logDictationFailedWithError:] 错误域=kAFAssistantErrorDomain Code=1700 "(null)"

class MySpeech:NSObject{
 private var iosRecognizer: SFSpeechRecognizer?
 private var iosRequest: SFSpeechAudioBufferRecognitionRequest?
 private var iosTask: SFSpeechRecognitionTask?
 private let iosAVE = AVAudioEngine()
 private let avSession = AVAudioSession.sharedInstance()

 func avINIT(){
    try? avSession.setCategory(AVAudioSessionCategoryPlayAndRecord, with: [.allowBluetooth])
    try? avSession.setMode(AVAudioSessionModeMeasurement)
    try? avSession.setActive(true, with: .notifyOthersOnDeactivation)
 }
 func switchHFP(){
    do{
        //try avSession.setActive(false)
        try avSession.setCategory(AVAudioSessionCategoryPlayAndRecord, with: [.allowBluetooth])
        try avSession.setActive(true, with: .notifyOthersOnDeactivation)
    } catch {
        debugPrint("HFP error: …
Run Code Online (Sandbox Code Playgroud)

ios swift sfspeechrecognizer

6
推荐指数
1
解决办法
4199
查看次数

标签 统计

ios ×1

sfspeechrecognizer ×1

swift ×1