iOS 版本更新

來源:互聯網
上載者:User

標籤:http   io   os   ar   for   sp   檔案   on   cti   

擷取目前的版本、比較線上版本、然後決定是否更新目前的版本:    //////擷取 info.plist檔案內容    NSDictionary *infoDic = [[NSBundle mainBundle] infoDictionary];      ////擷取general 裡的 build    NSString *appVersion = [infoDic objectForKey:@"CFBundleVersion"];    ////擷取general 裡的 version    NSString *currentVersion = [infoDic objectForKey:@"CFBundleShortVersionString"];    線上版本:    1、POST請求方式:http://itunes.apple.com/search?term=你的應用程式名稱&entity=software    2、http://itunes.apple.com/lookup?id=“tunes connect裡的 Apple ID”        用2擷取:    NSDictionary *dicVersion = [NSJSONSerialization JSONObjectWithData:dataes options:0 error:nil];    NSMutableArray *arrayVersion = [NSMutableArray arrayWithArray:[dicVersion objectForKey:@"results"]];        NSDictionary *resultsVersion = [arrayVersion objectAtIndex:0];    NSString *lastVersion = [resultsVersion objectForKey:@"version"];    NSString *trackViewUrl = [resultsVersion objectForKey:@"trackViewUrl"];    決定是否更新:    if ([arrayVersion count]) {        if (![lastVersion isEqualToString:currentVersion]) {            ////更新        }else{            ////不更新        }     }     ////官方文檔:www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.htm////////更新提醒:- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{    if (alertView.tag==888) {        if (buttonIndex==0) {            NSURL *url = [NSURL URLWithString:trackViewUrl];            [[UIApplication sharedApplication]openURL:url];        }    }}




iOS 版本更新

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.