您的位置:首页 > 移动开发 > IOS开发

iOS 软件进行版本更新

2015-08-11 17:23 453 查看
iOS版本更新 我们可以在didFinsihLaunchingWithOptions 写处理事件苹果给我们提供了appStore版本获取接口方法NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];[request setURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://itunes.apple.com/lookup?id=%@",appleID]]];//appleID传入自己app的ID号[request setHTTPMethod:@"GET"];NSData *returnData = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];NSDictionary *jsonData = [NSJSONSerialization JSONObjectWithData:returnData options:0 error:nil];in//可以通过获取到的jsondata 字典数据 获取到App Store版本信息NSDictionary *infoDict = [[NSBundle mainBundle] infoDictionary];NSString *currentVersion = [infoDict objectForKey:@"CFBundleVersion"];double doubleCurrentVersion = [currentVersion doubleValue];
然后通过App Store里的版本号  和本地app的版本号进行对比 如本地版本号低于了App Store的版本号 就提示更新
<span style="font-size: 9pt;">[[UIApplication sharedApplication] openURL:[NSURL URLWithString:trackViewUrl]]; //这里就可以通过传入trackViewUrl <软件在App Store里的地址> 系统就能跳转到更新界面</span>
unchingWithOptions
                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: