【发布时间】:2015-08-06 15:03:26
【问题描述】:
我在单例中使用AVSpeechSynthesizer。在 iOS 8 中,当应用程序在后台运行一段时间后,当它恢复时,AVSpeechSynthesizer 单例将不再说话。此问题在 iOS 7 上不会发生。
当应用程序进入后台时,我的日志中会显示以下消息:
AVSpeechSynthesizer Audio interruption notification: {
AVAudioSessionInterruptionTypeKey = 1;
}
我在单例的init 方法中像这样初始化AVSpeechSynthesizer:
self.speechSynthesizer = [[AVSpeechSynthesizer alloc] init];
self.speechSynthesizer.delegate = self;
我这样说utterance:
AVSpeechUtterance *utt = [[AVSpeechUtterance alloc] initWithString:dialogue];
utt.voice = [AVSpeechSynthesisVoice voiceWithLanguage:voice];
utt.pitchMultiplier = pitch;
utt.rate = rate;
utt.preUtteranceDelay = preDelay;
utt.postUtteranceDelay = postDelay;
utt.volume = volumeSetting;
[self.speechSynthesizer speakUtterance:utt];
有没有人在 iOS 8 上看到过类似的东西?
【问题讨论】:
-
模拟器和设备本身会发生这种情况吗?
-
在设备上 - AVSpeechSynthesizer 在模拟器上根本不工作(至少在 Xcode 6.0 中)。
-
AVSpeechSynth 在 8.2 beta 5 的模拟器中工作。
标签: ios ios8 avspeechsynthesizer