在appdelegate.m中写如下代码,即可检测当前版本
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
NSString* phoneVersion = [[UIDevice currentDevice] systemVersion];
NSLog(@"%@",phoneVersion);
if ([UIDevice currentDevice].systemVersion.floatValue>10) {
NSLog(@"大于10");
}else{
NSLog(@"不大于");
}
return YES;
}
结果如下: