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)
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)
whoah this weblog is magnificent i like studying your posts.
ReplyDeleteStay 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