< 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