【求助】UNNotificationServiceExtension 创建 AVSpeechSynthesizer 崩溃
求助
UNNotificationServiceExtension 里面只要一创建 [[AVSpeechSynthesizer alloc] init]; 就挂掉,然后直接推送出来了。
iOS10
请问有人遇到这种情况吗
在主工程里AVSpeechSynthesizer是OK的
另外UNNotificationServiceExtension 中播放 AVAudioPlayer 也是OK的
代码如下:
AVSpeechSynthesisVoice *voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"zh-CN"];
AVSpeechSynthesizer *synthesizer = [[AVSpeechSynthesizer alloc] init];
synthesizer.delegate = self;
AVSpeechUtterance *utterance = [AVSpeechUtterance speechUtteranceWithString:speekStr];
utterance.voice = voice;
[synthesizer speakUtterance:utterance];