iOS Multiple Version Programming

Posted by Daniel Vela on August 7, 2011

To use classes in a later version of our SDK “Target version” use this code:

Class myClass = NSClassFromString(@"UILocalNotification");  
if(myClass) {  
    UILocalNotification* alarm = [[myClass alloc] init];  

For methods use:

UIDevice* device = [UIDevice currentDevice];  
BOOL multitaskingSupported = NO;  
if([device respondsToSelector:@selector(isMultitaskingSupported)]) {  
    multitaskingSupported = [device isMultitaskingSupported];  

For functions use:

 if(&UIGraphicsBeginPDFContextToFile != NULL) {  

The same can be used for constant symbols.

For using later version frameworks, configure it as “weak-linking” in target build settings.