【发布时间】:2016-12-17 06:26:28
【问题描述】:
我以命令行/OSX/Swift 应用程序的形式启动了一个新的 Xcode 项目。我导入 AVFoundation 并在导入基础后将以下代码添加到顶级范围。
let string = "Hello, World!"
let utterance = AVSpeechUtterance(string: string)
utterance.voice = AVSpeechSynthesisVoice(language: "en-US")
let synthesizer = AVSpeechSynthesizer()
synthesizer.speakUtterance(utterance)
编译器抱怨AVSpeechUtterance 的标识符未解析。我也在 Cocoa 应用程序中尝试过这个,而不是命令行应用程序。我也尝试过链接 AVFoundation,尽管我认为这最近变得不必要了。
为什么我的 xcode 项目无法编译?
【问题讨论】:
标签: swift xcode avfoundation text-to-speech