1 本地版本号的获取
NSString *localVersion = [[[NSBundle mainBundle]infoDictionary] objectForKey:@"CFBundleShortVersionString"];
2 AppStore版本获取
以AFNetworking为例
AFHTTPSessionManager *manager =[AFHTTPSessionManager manager];
NSString *appUrl = [NSString stringWithFormat:@"http://itunes.apple.com/cn/lookup?id=%@",appleId];
[manager POST:appUrl parameters:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
NSString *newVersion;
NSArray *array = responseObject[@"results"];
NSDictionary *dict = [array lastObject];
newVersion =[dict objectForKey:@"version"];
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
}];
3 app跳转到Appstore下载界面
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"itms-apps://itunes.apple.com/app/idXXXXXXXXX"]];