我有一个奇怪的bug,它只出现在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: Error Domain=kAFAssistantErrorDomain Code=1700 "(null)“Error: Error Domain=kAFAssistantErrorDomain Code=1700 "(null)”
发布于 2020-06-04 09:30:07
我在我的应用程序中也遇到了同样的错误。将我的iphone从iOS 13.4.2更新到13.5.1,将XCode更新到11.5,这个错误已经修复。希望这能有所帮助。
https://stackoverflow.com/questions/61874811
复制相似问题