OGeek|极客世界-中国程序员成长平台

标题: ios - AVSpeechSynthesisVoice 未正确加载 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 09:00
标题: ios - AVSpeechSynthesisVoice 未正确加载

我想在 iOS 上玩文字转语音,但我立即遇到了障碍。声音不想改变为不同的语言或口音。仅供引用,我正在运行 iOS 9 beta 3,可能只是一个错误,但这是我的代码:

    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}

有没有其他人遇到过这个问题,我在网上找不到任何东西。谢谢。



Best Answer-推荐答案


代替"en-au",试着说"en-AU"

关于ios - AVSpeechSynthesisVoice 未正确加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31362825/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://jike.in/) Powered by Discuz! X3.4