Tôi đang sử dụng AVSpeechSynthesizer
trong một đĩa đơn. Trong iOS 8, khi ứng dụng được phát trong một thời gian, khi ứng dụng tiếp tục, singleton AVSpeechSynthesizer
sẽ không còn nói nữa. Sự cố này không xảy ra trên iOS 7.AVSpeechSynthesizer ngừng hoạt động sau khi nền
Khi ứng dụng được backgrounded, được thông báo sau xuất hiện trong nhật ký của tôi:
AVSpeechSynthesizer Audio interruption notification: {
AVAudioSessionInterruptionTypeKey = 1;
}
tôi khởi tạo AVSpeechSynthesizer
như thế này trong phương pháp init
của singleton:
self.speechSynthesizer = [[AVSpeechSynthesizer alloc] init];
self.speechSynthesizer.delegate = self;
và tôi nói utterance
như thế này:
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];
Có ai thấy bất cứ điều gì giống như thế này trên iOS 8?
Điều này xảy ra trên mô phỏng và thiết bị chính nó? – FiddleMeRagged
Trên thiết bị - AVSpeechSynthesizer không hoạt động ở chế độ mô phỏng (ít nhất là trong Xcode 6.0). – bmueller
AVSpeechSynth hoạt động trong trình mô phỏng trong phiên bản beta 8.2 5. –