如何处理被NS_DEPRECATED_IOS标记的selector, 例如:类
AVAudioSession中有:
- (BOOL)setPreferredHardwareSampleRate:(double)sampleRate error:(NSError **)outError NS_DEPRECATED_IOS(3_0, 6_0);
那么App需要支持iOS5到iOS7,那么该如何处理这种case呢?
Solution A:
AVAudioSession *asession = [AVAudioSession sharedInstance]; if ([asession respondsToSelector:@selector(newSelector:)]) { [asession newSelector:]; } else { [asession oldSelector:]; }
Maybe Solution B...