var unLocalizedSpeechRecognizer = SFSpeechRecognizer.init()
// unLocalizedSpeechRecognizer.supportsOnDeviceRecognition is most likely `false`
// change en-US to whatever locale you are targeting
var localizedSpeechRecognizer = SFSpeechRecognizer.init(locale: Locale(identifier: "en-US"))
// localizedSpeechRecognizer.supportsOnDeviceRecognition is most likely `true`
// if that local has been downloaded
1条答案
按热度按时间ctehm74n1#
请注意,
supportsOnDeviceRecognition
取决于区域设置。如果您使用目标区域设置初始化SFSpeechRecognizer
,则它将开始返回true
(假设设备上已下载了区域设置Siri词典):