判断APP是否是最新版本 和 获取 APP 版本号
<写在一个方法中>
- (void)VersionUpdate{
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
CFShow(infoDictionary);
NSString *app_Version = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
[manager GET:@"https://itunes.apple.com/cn/lookup?id=868722244" parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSDictionary *dic = (NSDictionary *)responseObject;
NSArray *arr = [dic objectForKey:@"results"];
NSString *app_NewVersion = [[arr objectAtIndex:0] objectForKey:@"version"];
//判断 然后 弹出 AlertView
if (![app_Version isEqualToString:app_NewVersion]) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"温馨提示" message:@"当前版本不是最新版本,是否更新" delegate:self cancelButtonTitle:@"下次更新" otherButtonTitles:@"更新", nil];
[alert show];
[alert release];
}
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
}];
}
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。