I want to check if the iOS
version of the device is greater than 3.1.3
I tried things like:
[[UIDevice currentDevice].systemVersion floatValue]
but it does not work, I just want a:
if (version > 3.1.3) { }
How can I achieve this?
I want to check if the iOS
version of the device is greater than 3.1.3
I tried things like:
[[UIDevice currentDevice].systemVersion floatValue]
but it does not work, I just want a:
if (version > 3.1.3) { }
How can I achieve this?
With Version class that is contained in nv-ios-version project (Apache License, Version 2.0), it is easy to get and compare iOS version. An example code below dumps the iOS version and checks whether the version is greater than or equal to 6.0.
Project Page: nv-ios-version
TakahikoKawasaki/nv-ios-version
Blog: Get and compare iOS version at runtime with Version class
Get and compare iOS version at runtime with Version class
I recommend:
credit: How to target a specific iPhone version?
Using the refered recommended way... if there is no definition in the header files, you can always get the versión printing it on console with a device of the desired IOS versión.
a bit late to the party but in light of iOS 8.0 out there this might be relevant:
if you can avoid using
[[UIDevice currentDevice] systemVersion]
Instead check for existence of of a method/class/whatever else.
I found it to be useful for location manager where I have to call requestWhenInUseAuthorization for iOS 8.0 but the method is not available for iOS < 8
Where of course,
NSFoundationVersionNumber_iOS_6_1
must be changed to by applicable for the iOS version you want to check. What I have now written will probably be used a lot when testing if a device is running iOS7 or a previous version.