Best Way Checking iPhone iOS Version

The best way to compare iPhone iOS Version

if ([[[UIDevice currentDevice] systemVersion] compare:@"6.0" options:NSNumericSearch] == NSOrderedAscending)
    {
        less then iOS 6.0
    }
    else
    {
        iOS 6.0
    }

Avoid Following Methods:
[[UIDevice currentDevice].systemVersion floatValue] (Not work for versions 5.1.2)
[[[UIDevice currentDevice] systemVersion] integerValue] < 5)
[[[UIDevice currentDevice] systemVersion] substringToIndex:0];
[UIDevice currentDevice] systemVersion] isEqualToString:@"6.0"];

Note:
UseFull Macros for checking versions (by yasirmturk) :
#define SYSTEM_VERSION_EQUAL_TO(v)                  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v)              ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v)                 ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v)     ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)

3 comments:

  1. whoah this weblog is magnificent i like studying your posts.
    Stay up the great work! You know, many individuals are hunting round for this info, you can
    help them greatly.

    My web blog: book of ra android boerse

    ReplyDelete
  2. Premium Blogger Templates Responsive Blogger and Wordpress Themes premium blogger templates free download

    ReplyDelete