iOS本地版本和服务器对比
- (BOOL)canShowUpdate:(NSString *)localVersion onlineVersion:(NSString *)onlineVersion { if (![localVersion isEqualToString:onlineVersion]) { NSArray *localArray = [localVersion componentsSeparatedByString:@"."]; NSArray *onlineArray = [onlineVersion componentsSeparatedByString:@"."]; NSUInteger length = localArray.count < onlineArray.count ? localArray.count : onlineArray.count; for (NSUInteger index = 0 ; index < length; index++) { if ([onlineArray[index] integerValue] > [localArray[index] integerValue] ) { if(index >= 1){ if ([onlineArray[index - 1] integerValue] >= [localArray[index - 1] integerValue]) { return YES; } } else { return YES; } } } if (onlineArray.count > localArray.count) { return YES; } } return NO; }