#pragma mark -
#pragma mark 版本比较方法
//比较版本的方法,在这里我用的是Version来比较的
- (BOOL)compareVersionsFormAppStore:(NSString*)AppStoreVersion WithAppVersion:(NSString*)AppVersion{
BOOL littleSunResult = false;
NSMutableArray* a = (NSMutableArray*) [AppStoreVersion componentsSeparatedByString: @"."];
NSMutableArray* b = (NSMutableArray*) [AppVersion componentsSeparatedByString: @"."];
while (a.count < b.count) { [a addObject: @"0"]; }
while (b.count < a.count) { [b addObject: @"0"]; }
for (int j = 0; j<a.count; j++) {
if ([[a objectAtIndex:j] integerValue] > [[b objectAtIndex:j] integerValue]) {
littleSunResult = true;
break;
}else if([[a objectAtIndex:j] integerValue] < [[b objectAtIndex:j] integerValue]){
littleSunResult = false;
break;
}else{
littleSunResult = false;
}
}
return littleSunResult;//true就是有新版本,false就是没有新版本
}
更新迭代版本时版本比较方法
最新推荐文章于 2022-09-14 22:34:04 发布