Determine if the app is the latest version and get the app version number

Source: Internet
Author: User

< write in a method >

-(void) versionupdate{

Nsdictionary *infodictionary = [[NSBundle mainbundle] infodictionary];

Cfshow (infodictionary);

NSString *app_version = [infodictionary objectforkey:@ "cfbundleshortversionstring"];

Afhttprequestoperationmanager *manager = [Afhttprequestoperationmanager manager];

[Manager get:@ "https://itunes.apple.com/cn/lookup?id=868722244" Parameters:nil success:^ (Afhttprequestoperation * operation, id responseobject) {

Nsdictionary *dic = (nsdictionary *) Responseobject;

Nsarray *arr = [dic objectforkey:@ "Results"];

NSString *app_newversion = [[arr objectatindex:0] objectforkey:@ "version"];

//Judge then pop Alertview

if (![ App_version Isequaltostring:app_newversion]) {

Uialertview *alert = [[Uialertview alloc] initwithtitle:@ "Warm tip" message:@ "current version is not the latest version, update" Delegate:self cancelbuttontitle:@ "Next Update" otherbuttontitles:@ "Update", nil];

[Alert show];

[Alert release];

}

} failure:^ (Afhttprequestoperation *operation, Nserror *error) {

}];

}

Determine if the app is the latest version and get the app version number

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.