How to check which iOS version your device is running

- by

We can check the UIDevice’s property systemVersion for this. Here’s a quick snippet that checks this, and conveniently checks the first number in the returned value. This should work until iOS 9…

NSArray *versionArray = [[[UIDevice currentDevice] systemVersion] componentsSeparatedByString:@"."];
    
if ([[versionArray objectAtIndex:0] intValue] >= 7) {
        
    // do this if we're runnign iOS 7 or higher
    return @"iOS 7 or higher";
        
} else {
        
    // do this if we're running iOS 6 or below     
    return @"iOS 6 or lower";
}

I’ve created a demo project for this code on GitHub:

https://github.com/versluis/iOS-Checkr

Inspired by this thread:

http://stackoverflow.com/questions/12561599/how-to-check-ios-version-is-ios-6



If you enjoy my content, please consider supporting me on Ko-fi. In return you can browse this whole site witout any pesky ads! More details here.

Add your voice!

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