Directly on the code:
/** * Detects if the software needs to be upgraded */-(void) checkversion{nsurl *url = [Nsurl urlwithstring:[nsstring stringwithformat:@] Http://itunes.a Pple.com/cn/lookup?id=%i ", Ifeverappid]]; ASIHTTPRequest *request = [[ASIHTTPRequest Alloc]initwithurl:url]; [Request Setusecookiepersistence:yes]; [Request Setdelegate:self]; [Request Setdidfailselector: @selector (getversionrequestfailed:)]; [Request Setdidfinishselector: @selector (getversionrequestsuccess:)]; [Request startasynchronous];//begins asynchronous request}-(void) getversionrequestfailed: (ASIHTTPRequest *) request1{NSLog (@ " Failed to get version information from AppStore!! ");} -(void) Getversionrequestsuccess: (ASIHTTPRequest *) request1{nsstring *newversion; NSData *responsedata = [Request1 responsedata]; Nsdictionary *dic = [nsjsonserialization jsonobjectwithdata:responsedata options:nsjsonreadingallowfragments Error: NIL]; Nsarray *resultarray = [dic objectforkey:@ "Results"]; For (ID config in resultarray) {newversion = [config valueforkey:@ "version"]; } if (newversion) {NSLog (@ "The version number obtained by AppStore is:%@", newversion); }//Get the local version number NSString *localversion = [[[NSBundle mainbundle]infodictionary]objectforkey:@ "cfbundleversion"]; NSString *msg = [NSString stringwithformat:@ "Your current version is v%@, discover new version v%@, do you want to download the new version?" ", Localversion,newversion]; if ([NewVersion floatvalue] > [localversion floatvalue]) {Uialertview *alert = [[Uialertview alloc]initwithtitl e:@ "Upgrade prompt!" message:msg delegate:self cancelbuttontitle:@ "next time" otherbuttontitles:@ "Upgrade Now", Nil]; Alert.tag = Kversionneedupdatealerttag; [Alert show]; }}
-(void) Alertview: (Uialertview *) Alertview Clickedbuttonatindex: (nsinteger) buttonindex{ if (Alertview.tag = = Kversionneedupdatealerttag) { //software requires update reminder if (Buttonindex = = 1) { Nsurl *url = [Nsurl urlwithstring:[ NSString stringwithformat:@ "https://itunes.apple.com/cn/app/wan-zhuan-quan-cheng/id%i?mt=8", Ifeverappid]]; [[UIApplication Sharedapplication]openurl:url]; /*//Open itunes Method Two: This method always prompts "Unable to connect to itunes" and is not recommended to use nsstring *ituneslink = @ "itms-apps://phobos.apple.com/ Webobjects/mzstore.woa/wa/viewsoftwareupdate?id=%i&mt=8 "; Nsurl *url = [Nsurl urlwithstring:[nsstring stringwithformat:@ "itms-apps://phobos.apple.com/webobjects/mzstore.woa/ Wa/viewsoftwareupdate?id=%i&mt=8 ", Ifeverappid]]; [[UIApplication sharedapplication] openurl:url]; */ } }}
If you want to know what information is returned when a network request AppStore, you can open this link: http://itunes.apple.com/cn/lookup?id=465039730
Reference blog:
Apps in IOS AppStore implement upgrade features Http://www.cnblogs.com/ygm900/p/3334586.html
Enterprise-Class certificate-based iOS App package upgrade feature Introduction
http://blog.csdn.net/sbvfhp/article/details/10336715
Another kind of code implementation idea
Http://hi.baidu.com/wwssttt/item/7446105e3c98fa3933e0a9d5
To get the software version of the code to AppStore, there are steps
http://blog.csdn.net/wave_1102/article/details/7463697
Ask AppStore for information about published apps--Pure ideas
Http://hi.baidu.com/yanh105/item/7378a98ffca6a8804414cfa0
Official Help documentation
Http://www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.html
How to improve the Upgrade alert feature for iOS clients
Http://www.cocoachina.com/applenews/devnews/2013/0108/5495.html
How does the iOS project implement version updates?
http://blog.csdn.net/mad1989/article/details/8130013
Resolves an issue that sends a request to AppStore to get a version without returning information
http://www.cocoachina.com/ask/questions/show/56158
iOS Development app Upgrade implementation