How can you determine and compare (>, <, etc.) the current OS version of the iPhone that the app is running on? There is a certain bug in 3.0 but not in 3.1+ so I'd like to be able to skip out a bit of code if the current OS version is not >= 3.1.
This needs to be at runtime not compile time!
You can for instance do something like this:
NSString *reqSysVer = @"3.1";
NSString *currSysVer = [[UIDevice currentDevice] systemVersion];
if ([currSysVer compare:reqSysVer options:NSNumericSearch] != NSOrderedAscending)
{
//Do some clever stuff
}
Do you mean determine the version of the OS? The SDK is fixed at build time, but the OS may change. To get the OS version, use [UIDevice currentDevice]. systemVersion. To get the SDK version, I think you can use __IPHONE_OS_VERSION_MIN_REQUIRED.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With