ios开发之APP升级的实现
2014-09-25 18:04
357 查看
直接上代码:
如果想知道网络请求AppStore时返回的信息可以打开这个链接:http://itunes.apple.com/cn/lookup?id=465039730
参考博文:
//另一种代码实现思路
http://hi.baidu.com/wwssttt/item/7446105e3c98fa3933e0a9d5
//向appStore获取软件版本的代码,有步骤
http://blog.csdn.net/wave_1102/article/details/7463697
//向 appstore 查询已发布 APP 的信息--纯思路
http://hi.baidu.com/yanh105/item/7378a98ffca6a8804414cfa0
//官方帮助文档
http://www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.html
//如何改进iOS客户端的升级提醒功能
http://www.cocoachina.com/applenews/devnews/2013/0108/5495.html
//ios项目如何实现版本更新?
http://blog.csdn.net/mad1989/article/details/8130013
//解决向appStore 发送请求获取版本,没有返回信息的问题
http://www.cocoachina.com/ask/questions/show/56158
/** * 检测软件是否需要升级 */ -(void)checkVersion { NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://itunes.apple.com/cn/lookup?id=%i",iFeverAPPID]]; ASIHTTPRequest *request = [[ASIHTTPRequest alloc]initWithURL:url]; [request setUseCookiePersistence:YES]; [request setDelegate: self]; [request setDidFailSelector:@selector(getVersionRequestFailed:)]; [request setDidFinishSelector:@selector(getVersionRequestSuccess:)]; [request startAsynchronous];//开始异步请求 } -(void)getVersionRequestFailed:(ASIHTTPRequest *)request1 { NSLog(@"从AppStore获取版本信息失败!!"); } -(void)getVersionRequestSuccess:(ASIHTTPRequest *)request1 { NSString *newVersion; NSData *responseData = [request1 responseData]; NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingAllowFragments error:nil]; NSArray *resultArray = [dic objectForKey:@"results"]; for (id config in resultArray) { newVersion = [config valueForKey:@"version"]; } if (newVersion) { NSLog(@"通过AppStore获取的版本号是:%@",newVersion); } //获取本地版本号 NSString *localVersion = [[[NSBundle mainBundle]infoDictionary]objectForKey:@"CFBundleVersion"]; NSString *msg = [NSString stringWithFormat:@"你当前的版本是V%@,发现新版本V%@,是否下载新版本?",localVersion,newVersion]; if ([newVersion floatValue] > [localVersion floatValue]) { UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"升级提示!" message:msg delegate:self cancelButtonTitle:@"下次再说" otherButtonTitles:@"现在升级", nil]; alert.tag = kVersionNeedUpdateAlertTag; [alert show]; } }
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { if (alertView.tag == kVersionNeedUpdateAlertTag) { //软件需要更新提醒 if (buttonIndex == 1) { NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://itunes.apple.com/cn/app/wan-zhuan-quan-cheng/id%i?mt=8",iFeverAPPID]]; [[UIApplication sharedApplication]openURL:url]; /* // 打开iTunes 方法二:此方法总是提示“无法连接到itunes”,不推荐使用 NSString *iTunesLink = @"itms-apps://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftwareUpdate?id=%i&mt=8"; NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"itms-apps://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftwareUpdate?id=%i&mt=8",iFeverAPPID]]; [[UIApplication sharedApplication] openURL:url]; */ } } }
如果想知道网络请求AppStore时返回的信息可以打开这个链接:http://itunes.apple.com/cn/lookup?id=465039730
参考博文:
iOS appStore中的应用 实现升级功能 http://www.cnblogs.com/ygm900/p/3334586.html
//基于企业级证书的IOS应用打包升级功能介绍 http://blog.csdn.net/sbvfhp/article/details/10336715//另一种代码实现思路
http://hi.baidu.com/wwssttt/item/7446105e3c98fa3933e0a9d5
//向appStore获取软件版本的代码,有步骤
http://blog.csdn.net/wave_1102/article/details/7463697
//向 appstore 查询已发布 APP 的信息--纯思路
http://hi.baidu.com/yanh105/item/7378a98ffca6a8804414cfa0
//官方帮助文档
http://www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.html
//如何改进iOS客户端的升级提醒功能
http://www.cocoachina.com/applenews/devnews/2013/0108/5495.html
//ios项目如何实现版本更新?
http://blog.csdn.net/mad1989/article/details/8130013
//解决向appStore 发送请求获取版本,没有返回信息的问题
http://www.cocoachina.com/ask/questions/show/56158
相关文章推荐
- ios开发之APP检查升级的实现
- iOS开发之APP升级的实现
- iOS开发之检测APP升级的实现
- ios开发小结之app发布升级
- 从今天开始学习iOS开发(iOS 7版)--实现一款App之使用设计模式
- IOS开发之实现App消息推送(最新)
- IOS开发之证书申请和实现App消息推送(最新)
- iOS开发-实现相机app的方法[转载自官方]
- AIR Native Extension实现iOS应用内付费(In-App Purchase)全教程(四)——ANE面向IAP的测试和开发
- IOS开发之实现App消息推送(最新)(1)
- iOS 托管App到FIR 实现软件内升级
- IOS开发之实现App消息推送(IOS 8)
- 从今天开始学习iOS开发(iOS 7版)--实现一款App之编写自定义类
- IOS开发之实现App消息推送(最新)(1)
- AIR Native Extension实现iOS应用内付费(In-App Purchase)全教程(四)——ANE面向IAP的测试和开发
- 从今天开始学习iOS开发(iOS 7版)--实现一款App之合并数据
- 从今天开始学习iOS开发(iOS 7版)--实现一款App之Foundation框架的使用
- 自己整理的ios app实现自动升级
- IOS开发之实现App消息推送(最新)
- IOS开发之实现App消息推送(最新)