Obtain the latest version information of the app in the appstore, update the version, and appstoreapp
There are two ways to update a version:
One is to obtain the latest version information from the server and compare it with the current app version.
The other is to obtain the latest version information on the appStore and compare it with the current app version.
Now let me explain how to get the latest version through appStore (refer to the official documentation of Apple below)
Https://affiliate.itunes.apple.com/resources/documentation/itunes-store-web-service-search-api/
For example, you can obtain the QQ icon, version number, and bundleID.
Open this link
Http://itunes.apple.com/search? Term = QQ & country = CN & entity = iPadSoftware
Term: the name of the app.
Country
Entity: indicates that the types include software, iPadSoftware, and macSoftware.
After the connection is opened, a JS file will be obtained. The content is in json format.
Parse json file to obtain app Information
Run the code below.
NSString * appName = @ "QQ"; // "" app's 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: 0 error: NULL]; // parse the json file
NSArray * results = [dict objectForKey: @ "results"];
NSDictionary * result = [results objectAtIndex: 0];
NSString * versionStr = [result objectForKey: @ "version"]; // Get the version of the app
self.version.text = versionStr;
NSString * bundle = [result objectForKey: @ "bundleId"]; // Get the id of the app
self.bundle.text = bundle;
According to the field: artworkUrl100 can also get the app icon, which is no longer written here