我有一个使用 AVSpeechUtterance 的应用程序,该应用程序在 iOS 12 之前一直运行良好。它仍然可以运行,但 en-US 语音听起来乱码。在 xcode 模拟器或新的 iPhone XS Max 上不会发生这种情况。这似乎只发生在 iPhone X 上。删除并重新安装该应用程序并不能解决问题。唯一的解决办法是将语音更改为 en-IE。 有其他人经历过这个或找到解决方法吗?
AVSpeechUtterance *utterance = [[AVSpeechUtterance alloc] initWithString:@"This is a test"];
utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"en-US"];
utterance.rate = AVSpeechUtteranceDefaultSpeechRate;
[self.synthesizer speakUtterance:utterance];
最佳答案
iOS12 Made 'en-US' 使用 Fred 而不是 Samantha,
尝试替换:
utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"en-US"];
与:
utterance.voice = [AVSpeechSynthesisVoice voiceWithIdentifier:@"com.apple.ttsbundle.Samantha-compact"];
关于ios - AVSpeechUtterance en-US 语音在 iOS 12 上听起来乱码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52693071/