iOS 百度导航没有语音播报
1.百度地图没有语音播报
可以尝试如下方式:
1.tts确认相关key正确,可以放入官方demo测试
2.setting中 Product Name 尝试设置成英文,在info.plist设置Bundle display name为app名称。
3.可以尝试使用自定义tts方式
[BNaviService_Instance initNaviService:nil success:^{ //导航SDK鉴权 [BNaviService_Instance authorizeNaviAppKey:BaiduMapKey completion:^(BOOL suc) { NSLog(@"authorizeNaviAppKey ret = %d",suc); }]; //TTS SDK鉴权 [BNaviService_Instance authorizeTTSAppId:BaiduTTS apiKey:TTS_API_KEY secretKey:TTS_SECRET_KEY completion:^(BOOL suc) { NSLog(@"authorizeTTS ret = %d",suc); }]; // 设置BNNaviSoundDelegate 代理 [BNaviService_Sound setSoundDelegate:self]; } fail:^{ NSLog(@"initNaviSDK fail"); }]; #pragma mark - BNNaviSoundDelegate - (void)onPlayTTS:(NSString*)text { NSLog(@"onPlayTTS text = %@", text); BOOL istts = [BNaviService_Sound isTTSPlaying]; BOOL s = [BNaviService_Sound resume]; BOOL p = [BNaviService_Sound playText:text]; // 自定义语音播报 [self customSound:text]; NSLog(@"istts:%d,s:%d,p:%d",istts,s,p); } /** 使用自定义的TTS语音播报 */ - (void)customSound:(NSString *)text { NSLog(@"%@",text); // 可以假想成要说的一段话 AVSpeechUtterance *utterance = [AVSpeechUtterance speechUtteranceWithString:text]; utterance.pitchMultiplier=0.8; //中式发音 AVSpeechSynthesisVoice AVSpeechSynthesisVoice *voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"zh-CN"]; //英式发音 // AVSpeechSynthesisVoice *voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"en-GB"]; utterance.voice = voice; NSLog(@"%@",[AVSpeechSynthesisVoice speechVoices]); // 语音合成器, 可以假想成一个可以说话的人, 是最主要的接口 AVSpeechSynthesizer *synth = [[AVSpeechSynthesizer alloc]init]; [synth speakUtterance:utterance]; }