ytschg
1.541K
· November 2012 ·
1f00639772b36298e7fdfe8ad8ce64b3

Backward compatible usage of iOS 6 APIs

Need to use iOS 6 specific APIs while maintaining backward compatibility in your app? Use conditional compilation preprocessor flags :

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_6_0
    #define IF_IOS6_OR_GREATER(...) \
    if(kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iPhoneOS_6_0) \
    { \
        __VA_ARGS__ \
    }
#else
    #define IF_IOS6_OR_GREATER(...)
#endif

Now you can safely wrap iOS 6 specific code with the IFIOS6OR_GREATER macro like this:

IF_IOS6_OR_GREATER  {
    //do iOS6 specific stuff...
};
Sign in or sign up to add your response.
Featured Programming Job

Front End Developer
·
Atlanta, GA
·
Full Time
Search all programming jobs