你好,歡迎來到IOS教程網

 Ios教程網 >> IOS訊息 >> 關於IOS >> IOS檢測版本更新(***為app id)

IOS檢測版本更新(***為app id)

編輯:關於IOS

[cpp]  

-(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);      //"version":"1.0"       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];  www.2cto.com     }          }   - (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];       }   }    
  1. 上一頁:
  2. 下一頁:
蘋果刷機越獄教程| IOS教程問題解答| IOS技巧綜合| IOS7技巧| IOS8教程
Copyright © Ios教程網 All Rights Reserved