vendredi 14 novembre 2014

How to continue to support iOS 5.1 as functions became deprecated


Vote count:

0




I have an app that must work for iOS versions >= 5.1.


Apple docs say that "The AudioSession API has been completely deprecated in iOS 7.0". And one should use AVAudioSession class instead.


But the method that I need (- (BOOL)setCategory:(NSString *)category withOptions:(AVAudioSessionCategoryOptions)options error:(NSError **)outError) is only available starting from iOS 6.0.


So it seems that I have to continue usage of deprecated AudioSessionSetProperty to support iOS 5.1.


What is a correct way to handle such situations (my question is general, not only about this particular problem with audio)? Should I write something like



if ([[[UIDevice currentDevice] systemVersion] compare:@"6.0" options:NSNumericSearch] == NSOrderedAscending)
{
// use deprecated methods (AudioSessionSetProperty)
}
else
{
// use brand-new methods (AVAudioSession)
}


or maybe it's ok to just use AudioSessionSetProperty until it stops to compile?



asked 1 min ago

Nick

242






How to continue to support iOS 5.1 as functions became deprecated

Aucun commentaire:

Enregistrer un commentaire