How to check which iOS version your device is running

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:

Inspired by this thread:

One thought on “How to check which iOS version your device is running

  1. According to Apple’s iOS 7 Transitioning Guide, the following will check the iOS version via the Foundation framework. This code should be in application:didFinishLaunchingWithOptions (App Delegate):

    if (floor(NSFoundationVersionNumber) <- NSFoundationVersionNumber_iOS_6_1) {
        // Load resources for iOS 6
    } else {
        // Load recources for iOS 7

Leave a Reply