iOS13 OnDevice Speech Recognition (supportsOnDeviceRecognition flag)

允我心安 提交于 2020-06-29 03:46:31

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!