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