获取appstore应用版本号
WS(ws);
ddownStr = @"http://itunes.apple.com/lookup?id=********";
[self defaultRequestwithURL:ddownStr withParameters:nil withMethod:kPOST withBlock:^(NSDictionary *dict, NSError *error) {
NSLog(@"%@",dict);
NSLog(@"🧊🧊%@",[dict objectForKey:@"results"]);
NSDictionary *infoDic = [[NSBundle mainBundle] infoDictionary];
NSString *currentVersion = infoDic[@"CFBundleShortVersionString"];
if ([dict objectForKey:@"results"]) {
NSArray *tempArr = [dict objectForKey:@"results"];
if (tempArr.count > 0) {
NSDictionary *tempDic = [tempArr objectAtIndex:0];
if ([tempDic objectForKey:@"version"]) {
NSString *verstring = [NSString stringWithFormat:@"%@",[tempDic objectForKey:@"version"]];
//当前版本号
NSInteger currentVerRR =
[[(NSMutableString *)currentVersion stringByReplacingOccurrencesOfString:@"." withString:@""] intValue];
//最新VV
NSInteger cNewVerRR =
[[(NSMutableString *)verstring stringByReplacingOccurrencesOfString:@"." withString:@""] intValue];
if (cNewVerRR > currentVerRR) {
[ws liz_showUpdateAlertWithOldVersion:currentVersion withNew:[NSString stringWithFormat:@"%@",verstring] withUrl:dJumpStr contentStr:content];
}
}
}
}
}];
网友评论