@interface MineViewController ()
@property (nonatomic, strong) AVSpeechSynthesizer *speechSynthesizer;
@implementation MineViewController
- (void)speak {
//version1
self.speechSynthesizer = [[AVSpeechSynthesizer alloc] init];
self.speechSynthesizer.delegate = self;
AVSpeechUtterance *utterance = [[AVSpeechUtterance alloc] initWithString:@"12345678"];
AVSpeechSynthesisVoice *voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"zh-CN"];
[utterance setVoice:voice];
//(worked speakUtterance successed)
[self.speechSynthesizer speakUtterance:utterance];
//version2
AVSpeechSynthesizer *speechSynthesizer = [[AVSpeechSynthesizer alloc] init];
speechSynthesizer.delegate = self;
AVSpeechUtterance *utterance = [[AVSpeechUtterance alloc] initWithString:@"12345678"];
AVSpeechSynthesisVoice *voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"zh-CN"];
[utterance setVoice:voice];
//(not worked speakUtterance no response)
[speechSynthesizer speakUtterance:utterance];
}