【问题标题】:AVFoundation classes not resolved in OSX xcode projectOSX xcode 项目中未解析的 AVFoundation 类
【发布时间】: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


    【解决方案1】:

    我相信这些仅适用于 iOS。在 OS X 上,类似的功能可以通过NSSpeechSynthesizer 获得。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-07-30
      • 2017-02-22
      • 1970-01-01
      • 2016-09-23
      • 1970-01-01
      相关资源
      最近更新 更多