iOS的AVFoundation库中提供了可以将文本转化成语音的方法,地图的语音导航能够用到。哈哈--!
核心代码:
AVSpeechSynthesizer *av = [[AVSpeechSynthesizer alloc]init];
AVSpeechUtterance *utterance = [[AVSpeechUtterance alloc]initWithString:@"你好"];
[av speakUtterance:utterance];
记得要到AVFoundation库进去。
demo放在github上了,点击打开链接