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...
};
Written by Cherif YAYA
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ios
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#