美文网首页
苹果版本更新接口

苹果版本更新接口

作者: iOS乐乐 | 来源:发表于2018-10-11 16:45 被阅读0次
        [MBProgressHUD showMessage:KLoading toView:KWINDOW];
        
        NSString*urlStr1=@"http://itunes.apple.com/cn/lookup?id=1406688801";
        
        AFHTTPSessionManager * manager = [AFHTTPSessionManager manager];
        
        [manager.requestSerializer willChangeValueForKey:@"timeoutInterval"];
        
        manager.requestSerializer.timeoutInterval = 10;
        
        [manager.requestSerializer didChangeValueForKey:@"timeoutInterval"];
        
        manager.responseSerializer = [AFHTTPResponseSerializer serializer];
        manager.responseSerializer.acceptableContentTypes=[NSSet setWithObjects:@"application/json", @"text/html",@"text/json", @"text/javascript",@"text/plain", nil];
        [manager GET:urlStr1 parameters:nil progress:^(NSProgress * _Nonnull downloadProgress) {
            // 传输进度
        } success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject)
         {
             [MBProgressHUD hideHUDForView:KWINDOW animated:YES];
             
             if (responseObject)
             {
                  NSString*str=[[NSString alloc]initWithData:responseObject encoding:NSUTF8StringEncoding];
                  DLog(@"str----->>%@",str);
                 
                 id responseObjectId=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
                 
                 if ([responseObjectId[@"resultCount"] integerValue]==0)
                 {
                     [MBProgressHUD showSuccess:@"暂无更新"];
                 }
                 else
                 {
                     NSString *newVersion;
                     NSArray *array = responseObjectId[@"results"];
                     
                     for (NSDictionary *dic in array)
                     {
                         newVersion = [dic valueForKey:@"version"];
                     }
                     //获取本地软件的版本号
                     NSString *localVersion = [[[NSBundle mainBundle]infoDictionary] objectForKey:@"CFBundleShortVersionString"];
                     NSString *updateMsg = responseObjectId[@"results"][0][@"releaseNotes"];
                     //对比发现的新版本和本地的版本
                     if ([newVersion doubleValue] > [localVersion doubleValue])
                     {
                         MLLUpdateView*updateView=[[MLLUpdateView alloc]initWithFrame:self.view.bounds WithMessage:updateMsg withUrl:responseObjectId[@"results"][0][@"trackViewUrl"] isForce:NO];
                         [updateView showAlert];
                     }
                     else
                     {
                         [MBProgressHUD showSuccess:@"已是最新版本"];
                     }
                 }
                 
             }
             
         } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error)
         {
             DLog(@"error-->%@",error);
             [MBProgressHUD hideHUDForView:KWINDOW animated:YES];
             
             
             [IanAlert alertWithTitle:@"当前网络不可用,请稍后再试" message:nil yes:@"好的" confirm:^{
                 
             }];
             
         }];

相关文章

  • 苹果版本更新接口

  • iOS实现版本的检测更新

    现在的版本更新大多数都是利用苹果官方给咱们的rest接口做检测更新! 检测更新的原理:拿到我们产品在苹果服务器上面...

  • iOS提示用户新版本更新(不从App Store获取版本信息)

    这个方式是从后台获取版本号,在苹果审核期间,保持接口返回数据是没有版本更新的信息,审核通过之后,后台修改接口返回的...

  • iOS提示用户新版本更新(不从App Store获取版本信息)

    这个方式是从后台获取版本号,在苹果审核期间,保持接口返回数据是没有版本更新的信息,审核通过之后,后台修改接口返回的...

  • iOS 版本更新

    众所周知苹果拒绝任何带有版本更新的提示出现在页面中,因此我们通过接口获取,处理是否显示更新提示。 1.判断版本号 ...

  • 菜鸟教程——iOS启动监测版本更新

    iOS开发当版本迭代时需要提示用户更新,以前基本都是走后台接口监测version字段更新,今天看到了苹果的API接...

  • 奇艺视频更新

    版本【1.1】版本 更新内容【添加新功能,修复接口,变为远程接口,以后不必频繁更新软件了】更新内容 新版本号【v1...

  • iOS-App检测更新

    在程序发布更新后想第一时间通知到各个用户,很多公司都会自己写一个接口通知版本更新。其实苹果有提供一个查询当前版本信...

  • iOS检测版本更新

    利用iTunes接口检查App版本更新

  • 2018-04-05

    《版本》2.0《版本》《更新内容》更新接口 更新功能 修复BUG《更新内容》《更新地址》《更新地址》《软件大小》2...

网友评论

      本文标题:苹果版本更新接口

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