ios - AVSpeechSynthesisVoice 未正确加载
<p><p>我想在 iOS 上玩文字转语音,但我立即遇到了障碍。声音不想改变为不同的语言或口音。仅供引用,我正在运行 iOS 9 beta 3,可能只是一个错误,但这是我的代码:</p>
<pre><code> let utter = AVSpeechUtterance(string: "hello and good morning")
let voice = AVSpeechSynthesisVoice(language: "en-au")
utter.voice = voice
if voice == nil {
print("bad voice")
}
let synth = AVSpeechSynthesizer()
synth.speakUtterance(utter)
</code></pre>
<p>它确实在控制台中给了我这个错误:</p>
<pre><code>AXAlternativeVoices was unable to retrieve custom voice assets. This could possibly be caused by someone requesting voices they are not entitled to. Error: Error Domain=ASError Code=15 "The operation couldn’t be completed. (ASError error 15 - Unable to copy asset information)" UserInfo=0x13e662970 {NSDescription=Unable to copy asset information}
</code></pre>
<p>有没有其他人遇到过这个问题,我在网上找不到任何东西。谢谢。</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>代替<code>"en-au"</code>,试着说<code>"en-AU"</code>。</p></p>
<p style="font-size: 20px;">关于ios - AVSpeechSynthesisVoice 未正确加载,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/31362825/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/31362825/
</a>
</p>
页:
[1]