更新时间:2022-11-18 18:22:40
NSSpeechSynthesizer
的.startSpeaking
需要在后台任务中执行,但是默认情况下在操场上是不可能的.
NSSpeechSynthesizer
's .startSpeaking
needs to execute in a background task, but by default this is not possible in a Playground.
您可以通过导入PlaygroundSupport
并设置异步模式来启用它,如下所示:
You can enable it by importing PlaygroundSupport
and setting asynchronous mode, like this:
import PlaygroundSupport
PlaygroundPage.current.needsIndefiniteExecution = true