我正在调用法语文本转语音功能。
这在以下设备上按预期工作:iOS 9.3模拟器、iOS 9.3设备 ( iPad 3rd gen)、iOS 10.3模拟器。不能在iOS 10.3设备 ( iPhone 6s) 上(静默)工作。
默认法语语音已安装并根据设备设置运行。
static AVSpeechSynthesizer* synthesizer = NULL;
//...
+(void)readText:(NSString*)text
{
if(synthesizer == NULL)
synthesizer = [[AVSpeechSynthesizer alloc] init];
AVSpeechUtterance *utterance = [AVSpeechUtterance speechUtteranceWithString:text];
utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"fr-FR"];
[synthesizer speakUtterance:utterance];
}
Run Code Online (Sandbox Code Playgroud)