迅速 – 无法让文字发音工作

当我尝试以下代码时,我收到以下消息:

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下工作,您可以在桌面上进行测试。

相关文章

软件简介:蓝湖辅助工具,减少移动端开发中控件属性的复制和粘...
现实生活中,我们听到的声音都是时间连续的,我们称为这种信...
前言最近在B站上看到一个漂亮的仙女姐姐跳舞视频,循环看了亿...
【Android App】实战项目之仿抖音的短视频分享App(附源码和...
前言这一篇博客应该是我花时间最多的一次了,从2022年1月底至...
因为我既对接过session、cookie,也对接过JWT,今年因为工作...