This question already has an answer here:
- How to check iOS version? 37 answers
I want to check if the user is running the app on iOS less than 5.0 and display a label in the app.
How do I detect which iOS is running on user's device programmatically?
Thanks!
In MonoTouch:
To get the Major version use:
For minor version use:
I know I am too late to answer this question. I am not sure does my method still working on low iOS versions (< 5.0):
You can get these results:
Best current version, without need to deal with numeric search within NSString is to define
macros
(See original answer: Check iPhone iOS Version)Those macros do exist in github, see: https://github.com/carlj/CJAMacros/blob/master/CJAMacros/CJAMacros.h
Like this:
and use them like this:
Outdated version below
to get OS version:
returns string, which can be turned into int/float via
like this
and compare like this
For Swift 4.0 syntax
below example is just checking if the device is of
iOS11
or greater version.