diff --git a/iphone/Maps/Core/TextToSpeech/MWMTextToSpeech.mm b/iphone/Maps/Core/TextToSpeech/MWMTextToSpeech.mm index da932040b..d82631f96 100644 --- a/iphone/Maps/Core/TextToSpeech/MWMTextToSpeech.mm +++ b/iphone/Maps/Core/TextToSpeech/MWMTextToSpeech.mm @@ -243,9 +243,24 @@ using Observers = NSHashTable; AVSpeechSynthesisVoice * voice = nil; for (NSString * loc in candidateLocales) { - voice = [AVSpeechSynthesisVoice voiceWithLanguage:loc]; - if (voice) + if (@available(iOS 16.0, *)) { + for (AVSpeechSynthesisVoice * aVoice in [AVSpeechSynthesisVoice speechVoices]) { + if (voice == nil && aVoice.language == loc && aVoice.quality == AVSpeechSynthesisVoiceQualityPremium) { + voice = aVoice; + } + } + } + for (AVSpeechSynthesisVoice * aVoice in [AVSpeechSynthesisVoice speechVoices]) { + if (voice == nil && aVoice.language == loc && aVoice.quality == AVSpeechSynthesisVoiceQualityEnhanced) { + voice = aVoice; + } + } + if (voice == nil) { + voice = [AVSpeechSynthesisVoice voiceWithLanguage:loc]; + } + if (voice) { break; + } } self.speechVoice = voice;