Home Features Docs Blog Support GitHub

How to check the iOS version running on the Device?


(Andrea Paci) #1

The title it’s pretty self explanatory, but anyway, I need to know if the user is using < 10.3 or >= 10.3
How can I achieve this?


(Tien Do Nam) #2

This works for me:

import apple.foundation.NSProcessInfo;
import apple.foundation.struct.NSOperatingSystemVersion;

[…]

NSOperatingSystemVersion version = NSProcessInfo.processInfo().operatingSystemVersion();
long major = version.majorVersion();
long minor = version.minorVersion();
long patch = version.patchVersion();

check for version >= 10.3:

if(NSProcessInfo.processInfo().operatingSystemVersion().majorVersion() >= 10 &&
   NSProcessInfo.processInfo().operatingSystemVersion().minorVersion() >= 3)

(Andrea Paci) #3

Well, it’s a bit too late know, I entirely skipped that part since I don’t think there are many devices running lower than 10.3.
But thanks anyway, maybe i’ll need it :slight_smile: