我的要求就像在后台为 UILocalNotification 警报正文启用 TTS(文本到语音)。这样系统就会在显示相应通知的同时读取警报正文。
提前致谢。
最佳答案
当您的本地通知进入您的前台应用程序时,您可以执行以下操作:
AVSpeechUtterance *utterance = [AVSpeechUtterance
speechUtteranceWithString:@"Replace this sentence with contents of local notification"];
AVSpeechSynthesizer *synth = [[AVSpeechSynthesizer alloc] init];
[synth speakUtterance:utterance];
我不确定当应用程序在后台且用户看不见时是否可以使用合成器。
有关此内容的更多详细信息,请参阅 this related question .
关于ios - 为 UILocalNotification 启用 TTS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31308664/