为什么我在iOS6上运行它时会出现错误,尽管我检查了AVSpeechSynthesizer
?我知道 AVSpeechSynthesizer 仅在 iOS7 中可用
if (NSClassFromString(@"AVSpeechSynthesizer")) {
AVSpeechSynthesizer *synthesizer = [[AVSpeechSynthesizer alloc] init];
AVSpeechUtterance *utterance = [AVSpeechUtterance speechUtteranceWithString:@"Just what do you think you're doing, Dave?"];
utterance.rate = AVSpeechUtteranceMinimumSpeechRate; // Tell it to me slowly
[synthesizer speakUtterance:utterance];
}