1. The software requires itself in the background server, set a new version number. Each time the login software pulls data from the background, the latest version number is compared with the current version number. Implement software updates.
2. Each login software pulls data from the Apple server and compares the latest version number with the current version number. Implement software updates.
The advantage of the first detection Update method is: Detection update speed, detection stability, the disadvantage is: the App Store version number is not synchronized (app shelves need to review time, not sure when the successful update to the App Store). The second method to detect the advantages of the Update method is: The detection version number is real-time synchronization, the disadvantage is: the Apple network is unstable, detection update delay is serious, some apps get no parameters.
Personal like to use the first, only need the background server based on the App Store version number to manually modify the data on the line, the app version number format can also be defined.
The code is as follows:
#pragma mark--get the latest version
-(void) getnewverion
{//1. Get interface string
NSString *getinformation = K_appinfo;
2. Get Data
[Updatadataservice requestdata:getinformation withresult:^ (id result) {
Nsdictionary *information = [result objectforkey:@ "results"][0];
1) Get the latest version
NSString *newversion = [Information objectforkey:@ "version"];
2) Get the current version
NSString *nowversion = [[[NSBundle Mainbundle] infodictionary] objectforkey:@ "cfbundleshortversionstring"];
NSString *message = [[NSString alloc] initwithformat:@ "* * * Latest version:%@, in order not to affect your use, please update as soon as possible!", newversion];
3) Determine if the latest version is greater than the current version
if ([NewVersion integervalue]>[nowversion IntegerValue])
{//4) The UI setting must be recalled to the main thread in an asynchronous call
Dispatch_async (Dispatch_get_main_queue (), ^{
Uialertview *alerview = [[Uialertview alloc] initwithtitle:@ "Prompt update" message:message delegate:self cancelbuttontitle:@ " Cancel Update "otherbuttontitles:@" OK Update ", nil];
[Alerview show];
});
}
}];
}
iOS Software update issues