[[UIDevice currentDevice] systemVersion] returns a string, i.e. "7.1.2".

if ([[[UIDevice currentDevice] systemVersion] compare:@"8.0"
options:NSNumericSearch] == NSOrderedDescending)
        // older than 8.0
else
        // 8.0 and newer

-----Original Message-----
From: cocoa-dev-bounces+juliuso=icodemonks....@lists.apple.com
[mailto:cocoa-dev-bounces+juliuso=icodemonks....@lists.apple.com] On Behalf
Of Gerriet M. Denkmann
Sent: Friday, July 18, 2014 3:41 AM
To: cocoa-dev@lists.apple.com
Subject: How to get iOS version at runtime?

How to get iOS version at runtime?

Like:

BOOL isRunningOnDeviceOrSimulatorInVersion8 = ???

I seem to have asked this question before (about OS X) and was told to use
either NSAppKitVersionNumber or NSFoundationVersionNumber.

iOS obviously has no NSAppKitVersionNumber, but I cannot find a
UIKitVersionNumber.

The stuff which behaves differently in 7.1.2 versus 8.0 is
UIKeyboardWillChangeFrameNotification, which looks more like UIKit.
Should I use NSFoundationVersionNumber anyway or what?

And: does the Simulator return the NSFoundationVersionNumber of the
simulated iOS (8.0) or the machine it is running on (10.9.4)?

ProcessInfo has operatingSystemVersionString which is documented as "not
appropriate for parsing".

Gerriet.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to