问题
I'm trying to get the iOS 13 OnDevice Speech recognition working. However validating the supportsOnDeviceRecognition flag, which is the preliminary step to enable OnDevice recognition, always returns false. I'm using iPad 6th Gen with iOS 13.3. I tested supportsOnDeviceRecognition flag with other devices and see it works only for some.
private var speechRecognizer = SFSpeechRecognizer(locale: Locale(identifier: "en_US"))
.
.
.
if #available(iOS 13, *) {
if speechRecognizer?.supportsOnDeviceRecognition ?? false {
recognitionRequest.requiresOnDeviceRecognition = true
}
}
I tried reading supportsOnDeviceRecognition multiple times after few seconds delay between each read per the below note, but it doesn't help.
According to the iOS 13 release notes:
The supportsOnDeviceRecognition property always returns false the first time it’s accessed. After a few seconds, accessing it again returns the correct value.
Has anyone encountered similar problem and how to go about this?
回答1:
I got the flag supportsOnDeviceRecognition finally returning true. I have to go to Settings > Siri & Search > Siri Voice.. I noticed the American (the one I want) was selected and it started downloading the dialect. After the download is complete, restarted the device and the flag became true.
来源:https://stackoverflow.com/questions/59957368/ios13-ondevice-speech-recognition-supportsondevicerecognition-flag