There are two ways to update a version
One is to get the latest version information from the server and compare it to the current app version
Another is to get the latest version information on AppStore and compare it to the current app version
Now let me take a look at how to get the latest version via AppStore (refer to Apple's official documentation below)
https://affiliate.itunes.apple.com/resources/documentation/itunes-store-web-service-search-api/
To get QQ version information as an example: You can get the QQ icon, version number and Bundleid
Open this link
http://itunes.apple.com/search?term=QQ&country=CN&entity= Ipadsoftware
Term: Represents the name of the app
Country: Representing the country
Entity: Representative type can choose to have software, Ipadsoftware, Macsoftware, don't say everybody also understand
This connection will be opened after a JS file, the content is the JSON format of the long look
Parse JSON file to get information about the app
Directly below the code
NSString *appname =@"QQ";//@ "app name"NSString *urlstr = [NSString stringWithFormat:@"Http://itunes.apple.com/search?term=%@&country=cn&entity=software", AppName]; Nsurl*url =[Nsurl Urlwithstring:urlstr]; NSData*json =[NSData Datawithcontentsofurl:url]; Nsdictionary*dict = [nsjsonserialization Jsonobjectwithdata:json options:0Error:null];//parsing JSON filesNsarray *results = [Dict objectforkey:@"Results"]; Nsdictionary*result = [Results objectatindex:0]; NSString*VERSIONSTR = [Result Objectforkey:@"version"];//get the app versionSelf.version.text =Versionstr; NSString* bundle = [result Objectforkey:@"Bundleid"];//get the App IDSelf.bundle.text = bundle;
Depending on the field: ArtworkUrl100 can also get the app icon it's not written here anymore.
Get the latest version of the app in AppStore and update it