Speech Synthesis on iOS weird errors on loading, and no concurrency

為{幸葍}努か 提交于 2019-12-06 14:05:01

As for #1, it's probably not gonna happen. The speech synthesizer is a system shared resource, so how the system handles scheduling multiple requests is out of our control as clients of the API. (Note that if you reuse the same synthesizer, it queues up extra utterances, but if you create multiple synthesizers, it fails to speak utterances that are requested while another synthesizer is speaking.)

Dunno about #2, sorry. Looks like diagnostic text, not necessarily an error. Probably worth filing a bug about, since they probably don't want to be logging diagnostics when there's no actual problem.

Bonus answer: You can use functional programming to make the selection of voice a bit shorter:

let voice = AVSpeechSynthesisVoice.speechVoices().first(where: { $0.name == "Arthur" })
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!