itunes can provide app version information, mainly through AppID, such as http://itunes.apple.com/lookup?id=946449501, when using only to find your own AppID in itunes Change to your own AppID
Use HTTP mode to read this link to get the JSON string for app information
Post part of the code
-(void) checkversion{asiformdatarequest *request = [asiformdatarequest requestwithurl:[nsurl URLWithString:strURL]] //strurl for your AppID address [request setrequestmethod:@ "POST"]; [Request Setdelegate:self]; [Request startasynchronous];} -(void) requestfinished: (ASIHTTPRequest *) request{nsstring *recstr = [[NSString alloc] Initwithdata: Request.responsedata encoding:nsutf8stringencoding]; RECSTR = [Recstr stringbytrimmingcharactersinset:[nscharacterset whitespaceandnewlinecharacterset]];// The returned string has a number of newline characters in front of it and needs to be removed nsdictionary *resultdic = [Jsonhelper deserializerdictionary:recstr];// Jsonhelper is the JSON parsing class that I encapsulated, and you can parse nsarray *infoarray = [resultdic objectforkey:@ "Results"] in your own way; if (Infoarray.count > 0) {nsdictionary* releaseinfo =[infoarray objectatindex:0]; nsstring* appstoreversion = [releaseinfo objectforkey:@ "version"]; Nsdictionary *infodic = [[NSBundle mainbundle] infodictionary]; NSString *currentversion = [Infodic objectforkey:@ "Cfbundleshortversionstring"]; Nsarray *curverarr = [CurrentVersion componentsseparatedbystring:@ ".]; Nsarray *appstoreverarr = [Appstoreversion componentsseparatedbystring:@ ".]; BOOL needupdate = NO; Compare version number size int MAXV = (int) MAX (curverarr.count, Appstoreverarr.count); int cver = 0; int aver = 0; for (int i = 0; i < MAXV; i++) {if (Appstoreverarr.count > i) {aver = [NSString stringwi thformat:@ "%@", Appstoreverarr[i]].intvalue; } else{aver = 0; } if (Curverarr.count > i) {cver = [nsstring stringwithformat:@ "%@", Curverarr[i]].intvalue; } else{cver = 0; } if (Aver > Cver) {needupdate = YES; Break }}//If an update is available if (needupdate) {trackviewurl = [[NSStringAlloc] Initwithstring:[releaseinfo objectforkey:@ "Trackviewurl"]];//trackviewurl temporary variable storage app, can let app jump to AppStore UIA lertview* alertview =[[uialertview alloc] initwithtitle:@ "version Upgrade" Message:[nsstring stringwithformat:@ "found a new version, upgrade? "] delegate:self cancelbuttontitle:@" Temporarily do not upgrade "otherbuttontitles:@" immediately upgrade ", Nil]; [Alertview show]; }}}-(void) Alertview: (Uialertview *) Alertview Clickedbuttonatindex: (Nsinteger) buttonindex{if (buttonindex = = 1) {uiapplication *application = [UIApplication sharedapplication]; [Application Openurl:[nsurl Urlwithstring:trackviewurl]; }}
iOS to determine if the app has an update available in AppStore