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?
UIDevice+IOSVersion.h
UIDevice+IOSVersion.m
As suggested by the official Apple docs: you can use the
NSFoundationVersionNumber
, from theNSObjCRuntime.h
header file.New way to check the system version using the swift Forget [[UIDevice currentDevice] systemVersion] and NSFoundationVersionNumber.
We can use NSProcessInfo -isOperatingSystemAtLeastVersion
Try the below code:
I know this is an old question, but someone should have mentioned the compile-time macros in
Availability.h
. All of the other methods here are runtime solutions, and will not work in a header file, class category, or ivar definition.For these situations, use
h/t this answer
Try this