IOS版本更新
2015-03-24 17:20
155 查看
做项目一般都是迭代开发,发布了第一个版本之后,经过用户的反馈和市场调研发现某些功能需要调整和改进,那么我们会在第一个版本的基础上进行修改,然后再发布第二个版本,那么问题就来了。当你产品第一个版本出来了,负责运营的团队就会大张旗鼓的去宣传,然后就有很多用户去下载这个产品。那么,当公司发布第二个版本的时候,难道还需要运营团队再次去宣传呢?当然没这么傻逼,我们软件开发人员会考虑这个问题的。版本更新的思路就是:程序每次运行的时候,先去检测目前手机本地版本和appstore上最新的版本,进行比较,如果发现appstore上有新的版本了,就弹出框提醒用户,该app发布新版本了,提醒用户下载。如果没有appstore上没有新的版本,那就不做声,当作什么事情都没发生,其实还是进行了版本的检测。好吧,不啰嗦了,上代码。
一、在didFinishLaunchingWithOptions方法中写入如下代码:
//获取本地的版本号
NSDictionary *infoDic = [[NSBundle mainBundle] infoDictionary];
NSString *appVersion = [infoDic objectForKey:@"CFBundleVersion"];
NSArray *arrVerSion = [RefresnVersion getVersionInformation];
if ([arrVerSion count]) {
NSDictionary *releaseInfo = [arrVerSion objectAtIndex:0];
NSString *lastVersion = [releaseInfo objectForKey:@"version"]; //appstore上的版本号
downAddree = [releaseInfo objectForKey:@"trackViewUrl"]; //appstore上的下载地址
if (![lastVersion isEqualToString:appVersion]) {
//trackViewURL = [releaseInfo objectForKey:@"trackVireUrl"];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"更新" message:@"有新的版本更新,是否前往更新?" delegate:self cancelButtonTitle:@"关闭" otherButtonTitles:@"更新", nil];
alert.tag = 1;
[alert show];
}
}
二、如果有新的版本,就好弹出框,然后我们在alertView clickedButtonAtIndex方法中进行新的版本下载的操作:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
//前往appstore下载最新版本
if (buttonIndex==1) {
NSURL *url = [NSURL URLWithString:downAddree]; //downAddress为你app在appstore上的下载地址
[[UIApplication sharedApplication]openURL:url];
}
}
didFinishLaunchingWithOptions
一、在didFinishLaunchingWithOptions方法中写入如下代码:
//获取本地的版本号
NSDictionary *infoDic = [[NSBundle mainBundle] infoDictionary];
NSString *appVersion = [infoDic objectForKey:@"CFBundleVersion"];
NSArray *arrVerSion = [RefresnVersion getVersionInformation];
if ([arrVerSion count]) {
NSDictionary *releaseInfo = [arrVerSion objectAtIndex:0];
NSString *lastVersion = [releaseInfo objectForKey:@"version"]; //appstore上的版本号
downAddree = [releaseInfo objectForKey:@"trackViewUrl"]; //appstore上的下载地址
if (![lastVersion isEqualToString:appVersion]) {
//trackViewURL = [releaseInfo objectForKey:@"trackVireUrl"];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"更新" message:@"有新的版本更新,是否前往更新?" delegate:self cancelButtonTitle:@"关闭" otherButtonTitles:@"更新", nil];
alert.tag = 1;
[alert show];
}
}
二、如果有新的版本,就好弹出框,然后我们在alertView clickedButtonAtIndex方法中进行新的版本下载的操作:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
//前往appstore下载最新版本
if (buttonIndex==1) {
NSURL *url = [NSURL URLWithString:downAddree]; //downAddress为你app在appstore上的下载地址
[[UIApplication sharedApplication]openURL:url];
}
}
didFinishLaunchingWithOptions
相关文章推荐
- iOS版本更新的方法
- iOS通过iTunes search检测版本更新,并提示用户更新!
- iOS学习笔记31—appStore检查版本更新与从app里跳到appstore评论页面
- ios检查版本更新
- iOS通过iTunes search检测版本更新,并提示用户更新!
- 安全短信(专业版)中英文2.0版本发布iOS 4.0重要更新
- ios 实现版本更新检查
- iOS通过iTunes search检测版本更新,并提示用户更新
- iOS通过iTunes search检测版本更新,并提示用户更新!
- ios版本更新
- 关于IOS开发中数据版本更新需要考虑的问题
- IOS检测版本更新(***为app id)
- iOS通过iTunes search检测版本更新,并提示用户更新!
- iOS通过iTunes search检测版本更新,并提示用户更新!
- WhatsNewIniOS(ios每个版本更新内容)
- iOS版本更新的方法
- iOS通过iTunes search检测版本更新,并提示用户更新!
- 10%的IOS设备已经更新到版本5.1.1
- iOS通过iTunes search检测版本更新,并提示用户更新!
- ios 使用ASIHTTPRequest来检查版本更新