当我尝试下面的代码时,我得到了以下消息:
2014-07-28 13:19:14.251 MySingleView3750:461865语音初始化错误: 2147483665
是我做错了什么,还是这是个bug?
我使用Xcode6 -Beta4在我的Mac上运行Mavericks的Mavericks 2模拟器中运行了这个iPad。
import UIKit
import AVFoundation
class ViewController: UIViewController {
var voice = AVSpeechSynthesizer()
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
@IBAction func buttonPushed(sender: UIButton) {
var utterance = AVSpeechUtterance(string:"This is a test")
voice.speakUtterance(utterance)
}
}
发布于 2014-10-25 07:34:53
iOS 8模拟器不支持文本到语音转换。然而,Xcode7模拟器仍然支持文本到语音转换(至少从Xcode6.1开始),所以如果你的应用在iOS 7下工作,你可以在你的桌面上测试它。
发布于 2014-12-12 21:40:01
从XCode 6.0.1开始,模拟器似乎根本不能与AVSpeechSynthesizer一起工作。如果您收到一条错误消息,如,这是模拟器问题,而不是程序问题。它应该可以在任何兼容的iOS设备上正常工作。请参阅此链接- https://github.com/brettdidonato/TextToSpeech/blob/master/README.md。我在iOS 8.0模拟器中遇到了同样的问题。但在iOS设备上工作正常。
发布于 2015-10-29 23:53:59
Text-to-speech使用iOS8.4模拟器,而不是其他8.X模拟器。
https://stackoverflow.com/questions/25001154
复制相似问题