在我的本机应用程序中,我需要一个后台服务来监听 Nfc 标签检测事件。我正在寻找一些像 android 后台服务一样工作的插件。
我正在使用AVSpeechSynthesizer发出一些文本数据的声音,它将首次使用,但此后则无法使用。
我得到以下消息。
错误:-
AppName [859:101035] [AXTTSCommon]无法启动音频队列alp!2018-10-26 18:06:53.253536 + 0530 AppName [859:101035] [AXTTSCommon] _BeginSpeaking:无法开始播放
下面我分享我的代码。
let synth = AVSpeechSynthesizer()
fileprivate func speakText(voiceOutdata: String )
{
let utterance = AVSpeechUtterance(string: voiceOutdata)
utterance.voice = AVSpeechSynthesisVoice(language: "en-US")
synth.speak(utterance)
}
Run Code Online (Sandbox Code Playgroud)