Possible Duplicate:
Check iPhone iOS Version
One of the changes made in iOS 5 is the ability to override the drawrect
methods. This means I need to change the appearance of the navigationBar and tabBar on a different way. I am able to use apple new methods:
[[UINavigationBar appearance]setBackgroundImage:[UIImage imageNamed:@"navigationBarBackgroundRetro.png"] forBarMetrics:UIBarMetricsDefault];
//I create my TabBar controlelr
tabBarController = [[UITabBarController alloc] init];
// I create the array that will contain all the view controlers
[[UITabBar appearance] setBackgroundImage:
[UIImage imageNamed:@"navigationBarBackgroundRetroTab.png"]];
[[UITabBar appearance] setSelectionIndicatorImage:
[UIImage imageNamed:@"tab_select_indicator"]];
I'm developing an app for iOS 4.3 and 5.0. However, iOS 5 ignores the drawrect
method that I'm overriding, so it should run the above code. How can I check the iOS version so I can use the above code if the device is on iOS 5?
Go to Settings > General > Software Update. The screen shows the currently installed version of iOS and whether an update is available.
From the Devices section of your Apple ID account page, you can see all of the devices that you're currently signed in to with your Apple ID, including Android devices, consoles, and smart TVs: Sign in to appleid.apple.com,* then select Devices.
Check the IMEI number of the phone on the product's box. Now visit Apple's website https://checkcoverage.apple.com/in/en . Click on the option 'IMEI number' here and type in the number printed on the phone box. If you don't find any details there, then the phone is fake.
The samples below work for any version number. e.g.: to detect iOS 5 instead 7, replace 7 with a 5 in the code.
This detects the SDK you are building with:
#ifdef __IPHONE_7_0
// iOS 7.0
#endif
This detects the version set as Deployment Target in the General tab of your target configuration:
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000
// iOS 7.0 or later
#else
// less than 7
#endif
BOOL isAtLeastIOS61 = NSFoundationVersionNumber >= NSFoundationVersionNumber_iOS_6_1;
BOOL isAtMost61 = NSFoundationVersionNumber <= NSFoundationVersionNumber_iOS_6_1;
BOOL is7x = floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1;
If you ⌘ click NSFoundationVersionNumber
, you'll see version constants for iOS and OSX. The constant for the current SDK is always missing.
BOOL atLeastIOS61 = kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_6_1;
As with NSFoundationVersionNumber
, the SDK version is missing.
NSString *version = [[UIDevice currentDevice] systemVersion];
BOOL isAtLeast6 = [version floatValue] >= 6.0;
BOOL isAtLeast7 = [version floatValue] >= 7.0;
An alternative way:
BOOL isAtLeast6 = [version hasPrefix:@"6."];
BOOL isAtLeast7 = [version hasPrefix:@"7."];
An alternative way:
BOOL isAtLeast6 = [version compare:@"6.0" options:NSNumericSearch] != NSOrderedAscending
BOOL isAtLeast7 = [version compare:@"7.0" options:NSNumericSearch] != NSOrderedAscending
In case of concerns about float/string conversion, let it be know that everything above reports correctly if the version is equal or greater, for any possible iOS version (6.0, 6.0.1, 6.1, etc.).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With