IOS Get AppStore version

Source: Internet
Author: User

Upgrades are generally involved when the project is launched. So how does iOS get to version from AppStore


Actually, very easy.

    NSString *url = [[NSString alloc] initwithformat:@ "Http://itunes.apple.com/lookup?

id=%@ ", @" 987953868 "];


The last number in the list is the unique ID of the current app. How to get this ID, Baidu a very easy


Then we just need to call this address. will return some information about the current app, including the version on AppStore (provided the project is online to AppStore)


We've done the process of getting it, and we're just using this method to call the address.

    Get AppStore version    nsstring *url = [[NSString alloc] initwithformat:@ "Http://itunes.apple.com/lookup?

id=%@ ", @" 987953868 "]; [Self postpath:url];




#pragma mark--Get data-(void) Postpath: (NSString *) path{nsurl *url = [Nsurl Urlwithstring:path];                                                           Nsmutableurlrequest *request = [Nsmutableurlrequest requestwithurl:url Cachepolicy:nsurlrequestreloadignoringcachedata Timeoutinterv        AL:10];            [Request sethttpmethod:@ "POST"];        Nsoperationqueue *queue = [Nsoperationqueue new]; [Nsurlconnection sendasynchronousrequest:request queue:queue completionhandler:^ (NSURLResponse *response,NSData *        Data,nserror *error) {nsmutabledictionary *receivestatusdic=[[nsmutabledictionary alloc]init]; if (data) {nsdictionary *receivedic = [Nsjsonserialization jsonobjectwithdata:data Options:nsjsonr            Eadingmutableleaves Error:nil]; if ([[Receivedic valueforkey:@ "Resultcount"] intvalue]>0) {[Receivestatusdic setvalue:@    "1" forkey:@ "status"];            [Receivestatusdic setvalue:[[[receivedic valueforkey:@ "results"] objectatindex:0] valueforkey:@ "version"] fo            rkey:@ "Version"];            }else{[Receivestatusdic setvalue:@ "-1" forkey:@ "status"];        }}else{[Receivestatusdic setvalue:@ "-1" forkey:@ "status"];    } [Self Performselectoronmainthread: @selector (receivedata:) withobject:receivestatusdic Waituntildone:no]; }];}

-(void) Receivedata: (ID) sender{    NSLog (@ "receivedata=%@", sender);    }

The final printed dictionary will include the version


receivedata={

status = 1;

Version = "1.0.0";

}



Okay, what's the problem? Welcome Dabigatran Discussion

Apple Development Group: 414319235 Welcome to add welcome discussion questions


IOS Get AppStore version

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.