iOS Software update issues

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.