美文网首页
判断IOS版本更新

判断IOS版本更新

作者: Amok校长 | 来源:发表于2016-09-18 13:58 被阅读0次

//检查版本更新

+(void)checkVersion:(void(^)(NSString*isCurrentVersion))block

{

//appid  1150237660

AFHTTPSessionManager*manager =[AFHTTPSessionManager manager];

NSString*urlString =[NSString stringWithFormat:@"http://itunes.apple.com/lookup?id=1150237660"];

[manager POST:urlString parameters:nil success:^(NSURLSessionDataTask *task, id responseObject) {

//最新版本

NSString*version =responseObject[@"results"][0][@"version"];

NSLog(@"AppStore最新版本:%@",version);

//当前版本

NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];

// 当前应用软件版本  比如:1.0.1

NSString *appCurVersion = [infoDictionary objectForKey:@"CFBundleShortVersionString"];

NSLog(@"当前应用软件版本:%@",appCurVersion);

if([appCurVersion isEqualToString:version]){

//是最新版本

block(@"1");

}else{

//不是最新版本,回调最新版本号过去

block(version);

}

} failure:^(NSURLSessionDataTask *task, NSError *error) {

}];

}

//判断当前版本弹出提示框

[HttpsRequestManager checkVersion:^(NSString *isCurrentVersion) {

if ([isCurrentVersion isEqualToString:@"1"]) {

//            TQ(@"提示", @"目前已经是最新版本", @"确定")

}else{

NSString*version =[NSString stringWithFormat:@"%@新版本来喽",isCurrentVersion];

UIAlertController*aaa =[UIAlertController alertControllerWithTitle:version message:@"火速一键升级至最新~" preferredStyle:UIAlertControllerStyleAlert];[aaa addAction:[UIAlertAction actionWithTitle:@"暂不下载" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {}]]; [aaa addAction:[UIAlertAction actionWithTitle:@"立即升级" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {

NSString *str = [NSString stringWithFormat:

@"itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=1150237660"];

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];

}]];[self presentViewController:aaa  animated:YES completion:^{}];

}

}];

相关文章

  • 判断IOS版本更新

    //检查版本更新 +(void)checkVersion:(void(^)(NSString*isCurrentV...

  • iOS版本更新判断

    应用每开发一个新版本时,都可能会有新特性介绍页面。所以在应用里就要判断是不是新版本,并且能判断只有第一次进入应用时...

  • iOS 判断设备版本

    iOS版本判断

  • iOS开发app版本更新判断

    通过接口http://itunes.apple.com/cn/lookup?id=appid可以查询到在AppSt...

  • iOS swift #available 和 @availab

    #available : 判断ios系统版本 #available(iOS 13.0, *) 代码如下: if ...

  • 判断iOS操作系统的几种方法

    方法一: 方法二: 方法三: 常用的是方法二和方法三 参考文章:【iOS 10 判断系统版本方式更新】

  • iOS版本更新

    iOS APP版本 更新

  • Vip视频解析助手(更新)

    判断版本〈2〉判断版本 更新内容【添加新功能,修复以前存在的Bug,更新UI更清新。详情请更新后自行体验! 更新时...

  • iapp远程更新例子

    版本判断2版本判断 截取内容软件名称:更新例子【换行】软件大小:6.6MB【换行】软件版本:2.0【换行】更新日期...

  • iapp远程更新例子

    版本判断2版本判断 截取内容软件名称:更新例子【换行】软件大小:6.6MB【换行】软件版本:2.0【换行】更新日期...

网友评论

      本文标题:判断IOS版本更新

      本文链接:https://www.haomeiwen.com/subject/cyowettx.html