【问题标题】:SFSpeechRecognizer fails with Error Domain=kAFAssistantErrorDomain Code=1700 on IpadSFSpeechRecognizer 在 Ipad 上失败,错误域 = kAFAssistantErrorDomain 代码 = 1700
【发布时间】:2020-09-04 13:25:44
【问题描述】:

我有一个奇怪的错误,它只发生在 iPad 物理设备、iPhone 物理设备和所有 iPad 模拟器上都运行良好,但在 iPad 物理设备上我得到 Error Domain=kAFAssistantErrorDomain Code=1700。这怎么会发生?

我的 SFSpeechRecognizer 代码:

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:] 错误域=kAFAssistantErrorDomain Code=1700 "(null)" 错误:错误域=kAFAssistantErrorDomain Code=1700 "(null)"

【问题讨论】:

    标签: ios swift ipad speech-recognition


    【解决方案1】:

    我的应用中出现了同样的错误。 该错误已修复,将我的 iphone 从 iOS 13.4.2 更新到 13.5.1 并将 XCode 更新到 11.5。 希望对您有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-04
      • 1970-01-01
      相关资源
      最近更新 更多