Micro.blog

Detect iOS 8 with Xcode 5.1.1

Advice, Articles Comments (0)

While prepping an app for submission that still supports iOS 6 & 7, we discovered a bug when the app in run under iOS 8. There was a change to EKEventViewController that leaves behind some UI when the view is dismissed. So we had to use the default method for presenting the view.

The way we tested for iOS 6 and 7 last year was to check the version with:

floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1)

However Xcode 5.1.1 doesn’t have an enum higher than NSFoundationVersionNumber_iOS_6_1, so it won’t detect an OS version higher than 6.1.

NB the recommended solution is to build your app with Xcode 6, which does recognize NSFoundationVersionNumber_iOS_7_1.

To detect the system version you can use “systemVersion” from “UIDevice”. It’s not decremented yet, so you can do something like:

NSLog(@”system %i”, [UIDevice currentDevice].systemVersion.intValue);

        NSString *version = [UIDevice currentDevice].systemVersion;

        if (version.intValue <= 7.1) {

            // Do something for iOS 7.1 or earlier

        } else {

            // Do something for iOS 8.0 or later

        }

This hasn’t been tested much, but give it a try.

The next release will be on Xcode 6 (I promise!)

Pin It

» Advice, Articles » Detect iOS 8 with Xcode...
On October 5, 2014
By
, , , , ,

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

« »