Ios6 dyld:找不到符号:_avSpeechoutanceMaximumSpeechRate
我正在尝试使用我的代码来兼容iOS 6和iOS 7,使用合成语音。 我希望它可以在iOS 7上使用,而不能在iOS 6上使用 问题是,当我在iOS 6的模拟器中运行时,它甚至在模拟器启动之前就给出了以下错误:Ios6 dyld:找不到符号:_avSpeechoutanceMaximumSpeechRate,ios6,dyld,Ios6,Dyld,我正在尝试使用我的代码来兼容iOS 6和iOS 7,使用合成语音。 我希望它可以在iOS 7上使用,而不能在iOS 6上使用 问题是,当我在iOS 6的模拟器中运行时,它甚至在模拟器启动之前就给出了以下错误:dyld:Symbol未找到:_avspeechutrancemaximumspeechrate 如果我对行进行注释:outrance.rate=avspeechoutrancemaximumspeechrate/4.0f对于iOS 6启动非常有用,即使它不是为它设计的 问题是什么 谢谢
dyld:Symbol未找到:_avspeechutrancemaximumspeechrate
如果我对行进行注释:outrance.rate=avspeechoutrancemaximumspeechrate/4.0f
对于iOS 6启动非常有用,即使它不是为它设计的
问题是什么
谢谢
if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1) {
// Load resources for iOS 7 or later
AVSpeechSynthesizer *synthesizer = [[AVSpeechSynthesizer alloc] init];
AVSpeechUtterance *utterance = [AVSpeechUtterance speechUtteranceWithString:selectedText];
utterance.rate = AVSpeechUtteranceMaximumSpeechRate / 4.0f;
utterance.voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"en-US"]; // defaults to your system language
[synthesizer speakUtterance:utterance];
[synthesizer release];
}
else{
// Load resources for iOS 6 or earlier
UIAlertView *alert = [[[UIAlertView alloc] initWithTitle:@"Sorry"
message:@"This feature requires iOS 7.0 or later"
delegate:Nil
cancelButtonTitle:@"OK"
otherButtonTitles: nil] autorelease];
[alert show];
}
只需在文件顶部添加以下行:
AVF_导出常量浮点AVSpeechutranceMaximumSpeechRate NS_可用IOS(7_0);
使用弱导入的符号,dyld不会在应用程序启动时找不到符号时崩溃