iOS检查版本更新,以及获取不到版本信息问题
来源:互联网 发布:投资 行业 知乎 编辑:程序博客网 时间:2024/05/29 08:10
-(void)versionURL{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0), ^{
//耗时的操作---获取某个应用在AppStore上的信息,更改id就行
//检测版本信息 一定要注意 首先查看自己的应用销售范围是 哪里? 如果是只有一个中国 请选择1方法,否则选择 方法 2
、、、、1. NSString *stringApp = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"https://itunes.apple.com/cn/lookup?id=。。"]
encoding:NSUTF8StringEncoding error:nil];
、、、、2.NSString *stringApp = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"https://itunes.apple.com/lookup?id=。。"]
encoding:NSUTF8StringEncoding error:nil];
if (stringApp!=nil || stringApp.length>0)
{
NSData *data = [stringApp dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil];
//获得上线版本号
NSString *version = [[[dic objectForKey:@"results"]firstObject]objectForKey:@"version"];
//获得当前版本
NSString *currentVersion = [[[NSBundle mainBundle]infoDictionary]objectForKey:@"CFBundleShortVersionString"];
int currentVersionnum = [[currentVersion stringByReplacingOccurrencesOfString:@"." withString:@""] intValue];
int lastVersionnum = [[version stringByReplacingOccurrencesOfString:@"." withString:@""] intValue];
dispatch_async(dispatch_get_main_queue(), ^{
//更新界面
if (lastVersionnum > currentVersionnum) {
//自定义的更新提示弹框
}else{
//已是最高版本
NSLog(@"已经是最高版本");
}
});
}
});
}
//点击跳转到appstore
-(void) nowNewBtnClick:(UIButton *)btn{
NSURL *url = [NSURL URLWithString:@"App在appstore的URL"];
[[UIApplication sharedApplication]openURL:url];
}
阅读全文
0 1
- iOS检查版本更新,以及获取不到版本信息问题
- ios检查版本更新
- ios检查版本更新
- IOS 版本检查更新
- ios检查版本更新
- ios检查版本更新
- ios检查版本更新
- ios检查版本更新
- iOS检查版本更新
- IOS 检查版本更新
- IOS 检查版本更新
- iOS 版本检查更新
- ios检查版本更新
- IOS检查版本更新
- ios版本检查更新
- ios 实现版本更新检查
- ios 实现版本更新检查
- ios 实现版本更新检查
- HTTP协议头字段
- PAT 1006. 换个格式输出整数
- iOS中YYModel的常见用法
- markdown编辑快捷键
- Eclipse中移除未使用的类引用的三种办法
- iOS检查版本更新,以及获取不到版本信息问题
- Windows 远程执行工具PsExec
- iOS中流水布局的几种常见方法
- Android框架之Camera(1)Camera服务的前世今生
- C#读取ini文件数据的方法和后台服务的相关知识
- Android Studio常用快捷键
- JAVA中Set接口
- 读取assets目录下的文件详细介绍
- NOIP2017模拟赛(二)总结