所以我只想尝试使用Swift的AVSpeechSynthesizer.我无法弄清楚如何为AVSpeechUtterance设置短语.
原文链接:https://www.f2er.com/swift/320162.html@IBAction func buttonSpeakClicked(sender:UIButton) { var mySpeechSynthesizer:AVSpeechSynthesizer = AVSpeechSynthesizer() var myString:String = "This is the phrase to say" var mySpeechUtterance:AVSpeechUtterance = AVSpeechUtterance(string:myString) println("\(mySpeechUtterance.speechString)") println("My string - \(myString)") mySpeechSynthesizer .speakUtterance(mySpeechUtterance) }@H_502_2@第一次打印 – 没有
第二个println – 这就是要说的那句话
文档说init(字符串字符串:字符串!),但我无法弄清楚放在哪里