比较iOS版本号大小 eg:3.2.0和3.1.0 或者 3.2.0和3.2比较
返回bool值变量YES or NO
-(BOOL)compareVesionWithServerVersion:(NSString *)version{
NSArray *versionArray = [version componentsSeparatedByString:@"."];//服务器返回版
NSArray *currentVesionArray = [APP_VERSION componentsSeparatedByString:@"."];//当前版本
NSInteger a = (versionArray.count> currentVesionArray.count)?currentVesionArray.count : versionArray.count;
for (int i = 0; i< a; i++) {
NSInteger a = [[versionArray safeObjectAtIndex:i] integerValue];
NSInteger b = [[currentVesionArray safeObjectAtIndex:i] integerValue];
if (a > b) {
NSLog(@"有新版本");
return YES;
}else if(a < b){
return NO;
}
return NO;
}