I don’t yet have time to fully going into iOS mods and building but I need to get another update out with iOS 5.1 and 4.4 SDK. I want to change one displayed button for people on iOS now. Not sure if this would work or not. I’m basically going forward instead of backward with a NSClassFromString check. Is this build specific or is it just based on the built SDK version? I just want to check to see the iOS version to know what to show and where on the screen. Pure old school functionality with nothing new for iOS6 but I am building with 5.1 and targeting to 3.0 (still).
if (NSClassFromString(@"UICollectionView")) {
// Here is old code to show a simple button
// that only shows differently for iOS6
} else { // same old button that will work as before on older devices
}
Thanks for any thoughts you may have…
To make code only available in version a.b.c and after, wrap it in a run-time version check:
However, in general it is better not to make any assumptions about the OS version (or the device type), and instead check explicitly for the functionality to be present. Indeed use
NSClassFromString(..)to see if a class is available. Use[object respondsToSelector:]to see if an object supports a certain method.