[英]SFSpeechRecognizer kAFAssistantErrorDomain Code=203 “Retry”
[英]SFSpeechRecognizer fails with Error Domain=kAFAssistantErrorDomain Code=1700 on Ipad
我有一個奇怪的錯誤,它只發生在 iPad 物理設備、iPhone 物理設備和所有 iPad 模擬器上都很好用,但是在 iPadError 物理設備上得到錯誤代碼域=124867CZTError 設備。 這怎么可能發生?
我的 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 物理設備上我得到:
[實用程序] +[AFAggregator logDictationFailedWithError:] 錯誤域=kAFAssistantErrorDomain 代碼=1700“(空)”錯誤:錯誤域=kAFAssistantErrorDomain 代碼=1700“(空)”
我的應用程序中出現了同樣的錯誤。 該錯誤已修復,將我的 iphone 從 iOS 13.4.2 更新到 13.5.1 和 XCode 更新到 11.5。 希望這有幫助。
我在 macOS 上遇到了這個問題,這僅僅是因為沒有先請求授權。
[SFSpeechRecognizer requestAuthorization: ...]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.