苹果版本跟新的提示
来源:互联网 发布:mgcp对接时默认端口号 编辑:程序博客网 时间:2024/04/27 05:38
static NSString *appid = @"1160216987"; //苹果上架的app id
static NSString *appurl = @"http://itunes.apple.com/lookup?id=%@";
//网络请求
-(void)updatasApp
{
NSString *appurlStr = [NSStringstringWithFormat:appurl,appid];
NSURL *url = [NSURLURLWithString:appurlStr];
NSURLRequest *requet = [[NSURLRequestalloc]initWithURL:urlcachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheDatatimeoutInterval:10];
__weakAppDelegate *blockself = self;
[NSURLConnectionsendAsynchronousRequest:requet queue:[NSOperationQueuemainQueue] completionHandler:^(NSURLResponse *_Nullable response, NSData *_Nullable data, NSError *_Nullable connectionError)
{
if (connectionError ==nil)
{
//这里应该刷新UI了
//1.给数据源数组赋值
//2,赋值结束之后.刷新UI([self.tableView reloadData])
NSDictionary *appInfoDict = [NSJSONSerializationJSONObjectWithData:data options:NSJSONReadingAllowFragmentserror:nil];
NSArray *resultArray = [appInfoDictobjectForKey:@"results"];
if (resultArray.count )
{
NSDictionary *infoDict = [resultArrayobjectAtIndex:0];
NSString *updateVersion = infoDict[@"version"];
dispatch_async(dispatch_get_main_queue(), ^{
blockself.UpdatesString = infoDict[@"trackViewUrl"];
[blockself getVersion:updateVersion];
});
}
}
}];
}
-(void)getVersion:(NSString *)version
{
NSDictionary *infodic = [[NSBundlemainBundle] infoDictionary];
NSString *CurrentVersion = [infodicobjectForKey:@"CFBundleShortVersionString"];
//获取本地的版本号
if ([CurrentVersionisEqualToString:version])
{
}
else{
UIAlertView *alertView = [[UIAlertViewalloc]initWithTitle:@"新版本更新"message:nildelegate:selfcancelButtonTitle:@"取消"otherButtonTitles:@"升级",nil];
alertView.tag =999;
[alertView show];
}
}
//判断用户点击了哪一个按钮
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex: (NSInteger)buttonIndex
{
if (alertView.tag ==999) {
if (buttonIndex ==1) { //点击”升级“按钮,就从打开app store上应用的详情页面
[[UIApplicationsharedApplication] openURL:[NSURLURLWithString:self.UpdatesString]];
}
}
}
- 苹果版本跟新的提示
- appcan 版本跟新
- ios版本跟新
- 版本跟新
- [iOS AppStore] 根据AppStore中的App版本 做跟新提示
- 版本跟新 导入类名 Conf
- iOS如何取得APP的版本信息跟服务器对比进行升级提示
- iOS如何取得APP的版本信息跟服务器对比进行升级提示?
- OS如何取得APP的版本信息跟服务器对比进行升级提示?
- tomcat的版本跟换后错误提示:target runtime apache Tomcat v7.0 not defined
- 苹果雪豹版本10.6.X安装xcode 4.2 提示安装失败的解决方法
- 假如已经安装了 新的JDK版本 Android Studio 模拟器预览还是提示版本 更新
- git跟新gitbub的代码(首次跟新步骤)
- ios8---苹果的新时代
- 苹果发布Safari浏览器新“补丁”版本Safari 5.1.5
- 友盟自动更新:超快速实现提示跟新和强制跟新
- 软件更新提示(检查app store 软件是否有新的版本)---需要app id
- 跟新删除某列值的后缀
- instanceof 关键字
- sql之left join、right join、inner join的区别
- Serializable And Parcelable
- PoEdu_24_字符串处理(fgets与gets)
- 这是最好的时光 这是最坏的时光 v0.1.1.1
- 苹果版本跟新的提示
- (第七周项目2)建立链队算法库
- Java访问权限控制修饰符比较
- MySQL读写分离介绍及搭建
- hdu 1027(全排列)
- MAC地址和IP地址的关系
- 第七周项目3-——负数把正数赶出队列
- openHMD-simple代码分析(1/2)
- 目标检测--PVANET: Deep but Lightweight Neural Networks for Real-time Object Detection