美文网首页
通过下载链接检测版本更新

通过下载链接检测版本更新

作者: Niklaus_8871 | 来源:发表于2018-04-23 15:45 被阅读0次

-(void)GetUpdate

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

    NSString *nowVersion = [infoDict objectForKey:@"CFBundleVersion"]; 

    NSURL *url = [NSURL URLWithString:@"http://itunes.apple.com/lookup?id=***"]; 

    NSString * file =  [NSString stringWithContentsOfURL:url]; 

    NSLog(file); 

    NSRange substr = [file rangeOfString:@"\"version\":\""]; 

    NSRange substr2 =[file rangeOfString:@"\"" options:NULL range:NSRange{substr.location+substr.length,10}]; 

    NSRange range = {substr.location+substr.length,substr2.location-substr.location-substr.length}; 

    NSString *newVersion =[file substringWithRange:range]; 

    if([nowVersion isEqualToString:newVersion]==NO) 

    { 

        UIAlertView *alert = [[UIAlertView alloc]initWithTitle:nil message:@"版本有更新" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"更新", nil]; 

        [alert show];

    } 

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex 

  if(buttonIndex==1) 

  { 

      NSURL *url = [NSURL URLWithString:@"https://itunes.apple.com/us/app/qun-xiang-dao/id***?ls=1&mt=8"]; 

      [[UIApplication sharedApplication]openURL:url]; 

  } 

相关文章

  • 通过下载链接检测版本更新

    -(void)GetUpdate { NSDictionary *infoDict = [[NSBundle ...

  • 【Android OTA】应用的更新升级

    原文链接 Android应用经常会内置检测版本更新的功能,在有版本更新的时候,通过下载更新文件进行本地的升级。本文...

  • 更新3.2

    版本【0.7】版本 更新内容【点击下载,修复登陆bug】更新内容 下载链接【http://qq.com】下载链接

  • 猎梦快讯app检测更新

    【版本】0.1【版本2】【更新细节】 1、添加检测更新 2、添加下载功能 【更新细节2】【下载地址】http://...

  • Android 应用更新 适配Android Q

    1.通过后台检测版本信息,与本地版本信息进行对比。贴出获取本地版本信息的代码 2.弹窗提示用户进行下载(是否更新,...

  • d d os更新专用

    软件版本5.17.0软件版本 更新下载链接http://viewer.maka.im/k/NCMM3TXX更新下载...

  • iapp远程更新

    更新标题【有新版本了可更新】更新标题 更新内容【-修复Bug -修复下载】更新内容 新版本【1.0】新版本 链接【...

  • ReactNative App更新下载(Android+iOS)

    APP涉及到版本更新(非热更新),版本检测下载App,Android和iOS实现方式不同 1.Android直接和...

  • [Q盾]自动赞助系统-赞助端

    版本:103 下载链接: 更新日志:版本:1.0.3【请勿更新,否则后果自负!】 1、首次增加自动更新功能 END

  • 实现iOS版本更新提示并跳转App Store

    目录 QuickTime PlayeriOS通过iTunes search检测版本更新,并提示用户更新!How t...

网友评论

      本文标题:通过下载链接检测版本更新

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