IOS version Update

Source: Internet
Author: User

Get the current version, compare the online version, and then decide whether to update the current version:     //////get  info.plist file contents      nsdictionary *infodic = [[nsbundle mainbundle] infodictionary];       ////gets  build    nsstring *appversion = in general .  [infodic objectforkey:@ "Cfbundleversion"];    ////get the   in general  version    nsstring *currentversion = [infodic objectforkey:@ " Cfbundleshortversionstring "];     online version:     1, POST request mode:/HTTP Itunes.apple.com/search?term= your application name &entity=software    2, http://itunes.apple.com/ Lookup?id= " apple id in Tunes connect"          get:  with 2    nsdictionary *dicversion = [nsjsonserialization jsonobjectwithdata: dataes options:0 error:nil];   &nbsp nsmutablearray *arrayversion = [nsmutablearray arraywitharray:[dicversion  objectforkey:@ "Results"]];        nsdictionary *resultsversion  = [arrayversion objectatindex:0];    nsstring *lastversion =  [resultsversion objectforkey:@ "Version"];    nsstring *trackviewurl =  [resultsversion objectforkey:@ "Trackviewurl"];     decide whether to update:     if  ([Arrayversion count])  {        if  (![ Lastversion isequaltostring:currentversion])  {             ////Update         }else{             ////not updated         }      }     ////Official Document: www.apple.com/itunes/affiliates/resources/documentation/ itunes-store-web-service-search-api.htm////////Update reminder:-  (void) Alertview: (uialertview *) alertView  Clickedbuttonatindex: (Nsinteger) buttonindex{    if  (alertview.tag==888)  {         if  (buttonindex==0)  {             NSURL *url = [NSURL URLWithString:trackViewUrl];             [[uiapplication sharedapplication] openurl:url];        }    }}




IOS version Update

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.