iOS 10中的AVSpeechSynthesizer错误

时间:2016-10-04 00:16:50

标签: swift xcode ios10 avspeechsynthesizer

我目前正在使用if (userInput.substring(i, i+1).matches("[^A-Za-z0-9 ]")) { countSpecial++; } 创建文字转语音应用。它在iOS 9中运行良好,但在iOS 10中出现以下错误:

  

无法获取属性' LocalURL':错误域= MobileAssetError代码= 1"无法复制资产属性" UserInfo = {NSDescription =无法复制资产属性}

有谁知道这里发生了什么?

AVSpeechSynthesizer()

错误发生在static let speechSynthesizer = AVSpeechSynthesizer() static func speak(text: String) { if speechSynthesizer.isSpeaking { speechSynthesizer.continueSpeaking() } else { let speechUtterance = AVSpeechUtterance(string: text) speechUtterance.rate = 0.45 // 0.0 -> 1.0 speechUtterance.pitchMultiplier = 1 // 0.5 -> 2.0 speechUtterance.volume = 0.75 // 0.0 -> 1.0 speechSynthesizer.speak(speechUtterance) } } 调用

之后

0 个答案:

没有答案