iOS 检查更新
注意:苹果官方是不允许app具有检查更新提示!
//直接跳转到AppStore
- (void)setUpAppUpdate {
[ServerData queryGetURL:@{@"URL":@"http://itunes.apple.com/search", @"dic":@{@"term":@"POPOLOOK", @"entity":@"software"}} successBlock:^(NSDictionary *dataDic) {
NSLog(@"-=-=-=-=-=-=-=-==-=-==APP检查更新:%@", dataDic);
} failBlock:^(NSString *errorMsg) {
//使用本地
}];
}
//在应用内打开AppStore界面
- (void)setUpAppUpdate2 {
[ServerData queryGetURL:@{@"URL":@"http://itunes.apple.com/lookup", @"dic":@{@"id":kPopolookAppleId}} successBlock:^(NSDictionary *dataDic) {
NSLog(@"-=-=-=-=-=-=-=-==-=-==APP检查更新2:%@", dataDic);
NSArray * tempAry = dataDic[@"results"];
if (!tempAry.count) {
return;
}
NSDictionary * tempDic = [tempAry firstObject];
NSLog(@"-=-=-=-=-=-=-=-==-=-==%@-=-=-=%@", kPopolookVER, tempDic[@"version"]);
if (![kPopolookVER isEqualToString:tempDic[@"version"]]) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:dataDic[@"trackViewUrl"]]];
}else {
NSLog(@"-=-=-=-=-=-=-=-==-=-==%@", @"已是最新版本");
}
} failBlock:^(NSString *errorMsg) {
//使用本地
}];
}