AFNetWorking 判断当前版本是否是最新版本
2016-04-19 14:11
316 查看
NSString *url = [[NSString alloc] initWithFormat:@"http://itunes.apple.com/lookup?id=%@",@"***"];
[self reqeautDataUrl:url parma:nil block:^(NSDictionary *dataDic, NSError *error) {
[self hideHud];
if(error){
[self showAlertView:@"版本获取失败"];
return ;
}
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
NSString *app_Version = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
if([[dataDic objectForKey:@"version"] isEqualToString:app_Version]){
UIActionSheet *actionSheet = [[UIActionSheet alloc]initWithTitle:@"提示" delegate:nil cancelButtonTitle:@"确定" destructiveButtonTitle:@"已经是最新版本" otherButtonTitles:nil, nil];
[actionSheet showInView:self.view];
}else {
UIActionSheet *actionSheet = [[UIActionSheet alloc]initWithTitle:@"提示" delegate:nil cancelButtonTitle:@"确定" destructiveButtonTitle:@"请更新最新的版本" otherButtonTitles:nil, nil];
[actionSheet showInView:self.view];
}
}];
[self reqeautDataUrl:url parma:nil block:^(NSDictionary *dataDic, NSError *error) {
[self hideHud];
if(error){
[self showAlertView:@"版本获取失败"];
return ;
}
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
NSString *app_Version = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
if([[dataDic objectForKey:@"version"] isEqualToString:app_Version]){
UIActionSheet *actionSheet = [[UIActionSheet alloc]initWithTitle:@"提示" delegate:nil cancelButtonTitle:@"确定" destructiveButtonTitle:@"已经是最新版本" otherButtonTitles:nil, nil];
[actionSheet showInView:self.view];
}else {
UIActionSheet *actionSheet = [[UIActionSheet alloc]initWithTitle:@"提示" delegate:nil cancelButtonTitle:@"确定" destructiveButtonTitle:@"请更新最新的版本" otherButtonTitles:nil, nil];
[actionSheet showInView:self.view];
}
}];
相关文章推荐
- 腾讯暑期实习生面试题
- snapshot standby database
- (NDK基础一)JNI中C调用Java方法
- Linux中Memcached的安装和配置方法
- css常用的中文字体
- JAVA笔试面试题系列之----①多线程
- 浏览器判断是否安装了ios/android客户端程序
- Java命令学习系列(一)——Jps
- ReDex —— Facebook 的 Android 字节码优化工具
- 如何启动、关闭和设置ubuntu防火墙
- 使用Gson解析和创建json
- HDU 1257 最少拦截系统
- android的 root权限
- 机器学习中常见问题_几种梯度下降法
- 如何让Toast消息在应用退出后不再显示
- Ubuntu 14.04下关于C连接MySQL数据库的环境配置
- Java命令学习系列(零)——常见命令及Java Dump介绍
- 日期格式:ddMMyy-hhmmss,格林威治时间转换成北京时间
- dispatch_semaphore
- 站立会议2