Featured Apps

MyMemes

Create Your Own Memes
Add captions to the most popular meme images or your own photos

Collaged

Create Photo Collages
Easily create photo collages to share with friends and family

Sleepify

Music Alarm Clock
Simple, stylist and intuitive music alarm clock

iOS 7 - Test if iOS device is running iOS 7

03 October 2013

These helpful functions let you test what version of iOS the current device is running, allowing for conditional code based on iOS version.

#define SYSTEM_VERSION_LESS_THAN(v)
    ([[[UIDevice currentDevice] systemVersion] compare:v 
        options:NSNumericSearch] == NSOrderedAscending)

#define kIsBeforeIOS7 (SYSTEM_VERSION_LESS_THAN(@"7.0"))
#define kIsIOS7 (!kIsBeforeIOS7)

Then just use the function to test for iOS 7.

if (kIsIOS7) {
    //do something for iOS 7 device
}