迅速 – 无法让文字发音工作
发布时间:2020-12-14 05:52:59 所属栏目:百科 来源:网络整理
导读:当我尝试以下代码时,我收到以下消息: 2014-07-28 13:19:14.251 MySingleView [3750:461865]语音初始化错误:2147483665 我做错了,还是这个bug? 我正在使用Xcode6 – Beta 4在我的Mac上运行小牛的iPad 2模拟器中运行。 import UIKitimport AVFoundatio
|
当我尝试以下代码时,我收到以下消息:
2014-07-28 13:19:14.251 MySingleView [3750:461865]语音初始化错误:2147483665 我做错了,还是这个bug? 我正在使用Xcode6 – Beta 4在我的Mac上运行小牛的iPad 2模拟器中运行。 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)
}
}
iOS 8模拟器不支持文字转语音。然而,iOS 7模拟器仍然支持文本到语音(至少与Xcode 6.1相同),所以如果您的应用程序在iOS 7下工作,您可以在桌面上进行测试。
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
