我想在iOS上播放文字对话,但我立即遇到了障碍。声音并不想改变为不同的语言或口音。仅供参考,我正在运行iOS 9 beta 3,可能只是一个bug,但是我的代码是:
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)
它确实在控制台中给出了这个错误:
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}
有没有其他人有这个问题,我在网上找不到任何东西。感谢。
答案 0 :(得分:1)
而不是"en-au"
,请尝试说"en-AU"
。
答案 1 :(得分:0)
这似乎是在beta 4中修复的。试过多个声音,一切似乎都恢复正常。