IOS AppStore Version Upgrade detailed

Source: Internet
Author: User

While the App store can alert users to software updates, many users do not proactively update a whole bunch of software (the software on my machine is about 100). It can be a lot better if you remind users to update or more in the "Check for Updates" Item when the software is turned on.
It is common practice to record the latest version number on your own server, request it from an iOS client, and compare it to the local version number, prompting for updates. This is a simple practice, with the disadvantage of requiring separate server support.

By reviewing the relevant articles, the following methods are found, similar to the above methods, but no additional server support is required. This is the best way to check for updates.

NSString *version = @ ""; Nsurl *url = [Nsurl urlwithstring:@ "http://itunes.apple.com/lookup?id=954270"];versionrequest = [asiformdatarequest Requestwithurl:url]; [Versionrequest setrequestmethod:@ "GET"]; [Versionrequest setdelegate:self]; [Versionrequest settimeoutseconds:150]; [Versionrequest addrequestheader:@ "Content-type" value:@ "Application/json"]; [Versionrequest startsynchronous];//response string of our REST callnsstring* jsonresponsestring = [versionrequest Responsestring]; Nsdictionary *loginauthenticationresponse = [jsonresponsestring objectfromjsonstring]; Nsarray *configdata = [Loginauthenticationresponse valueforkey:@ "Results"];for (ID config in configdata) {version = [con] Fig valueforkey:@ "version"];} Check your version with the version in App Storeif (![ Version isequaltostring:[itsuserdefaults objectforkey:@ "Version"]) {Proalertview *createuserresponsealert = [[ Proalertview Alloc] initwithtitle:@ "New version!!" message: @ "A New Version of app is available to download" DeLegate:self cancelbuttontitle:@ "Cancel" Otherbuttontitles: @ "Download", nil];    [Createuserresponsealert show]; [Createuserresponsealert release];}
-(void) Alertview: (Uialertview *) Actionsheet Clickedbuttonatindex: (Nsinteger) Buttonindex {    //the user clicked One Of the Ok/cancel buttons    if (Buttonindex = = 1)    {        NSString *ituneslink = @ "itms-apps://phobos.apple.com/ Webobjects/mzstore.woa/wa/viewsoftwareupdate?id=<appid>&mt=8 ";        [[UIApplication sharedapplication] Openurl:[nsurl urlwithstring:ituneslink];    }}

The data returned by the request http://itunes.apple.com/lookup?id=954270 is given a version of 2.3, compared to the local client version number to determine whether there is an update.

IOS AppStore Version Upgrade detailed

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.