标签:app版本更新
//判断有无新版 : http://itunes.apple.com/lookup?id=项目的appid
网络请求返回json块里:
//拿当前版本
NSDictionary *infoDic = [[NSBundle mainBundle] infoDictionary];
NSString *appVersion = [infoDic objectForKey:@"CFBundleVersion"];
//拿appstore上的版本
NSArray *infoArray = [JSON objectForKey:@"results"];
NSDictionary *releaseInfo = [infoArray objectAtIndex:0];
NSString *latestVersion = [releaseInfo objectForKey:@"version"];
//新版本的下载地址,也是app应用在appstore的地址
url = [releaseInfo objectForKey:@"trackViewUrl"];
if (![appVersion isEqualToString:latestVersion]) { //两个版本不等,则有新版本
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
}else
{
[self alertViewTitle:@"提示" andMessage:@"目前已是最新版本" andDelegate:self andCancelButtonTitle:@"确定" andOtherButtonTitle:nil];
}
标签:app版本更新
原文地址:http://5828666.blog.51cto.com/5818666/1654291