iOS Appstore 版本更新
1,版本更新 通过比较构建号/版本号 检查更新
/// 构建号 50 // NSString * currentVersion = [NSBundle mainBundle].infoDictionary[@"CFBundleVersion"]; /// 版本号 2.2.0 //CFBundleShortVersionString NSString * currentVersion = [NSBundle mainBundle].infoDictionary[@"CFBundleShortVersionString"]; NSLog(@"receiveData=%@",sender); // sender[@"version"] @"1.1.3" if ( [sender[@"version"] compare:currentVersion options:NSNumericSearch] == NSOrderedDescending) { UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"提示" message:@"有新版本更新,是否前往AppStore下载" delegate:self cancelButtonTitle:@"不去" otherButtonTitles:@"立即前往", nil]; alert.tag = 1000; /// 上线前打开 [alert show]; }
/* 线上 compare 本地 if ( [@"1.2.0" compare:@"1.1" options:NSNumericSearch] == NSOrderedDescending) { NSLog(@"1.2>1.1.1"); } */