获取appStore市场应用实时版本号 iOS

获取appstore应用版本号

    WS(ws);

    ddownStr = @"http://itunes.apple.com/lookup?id=********";

    [self defaultRequestwithURL:ddownStr withParameters:nil withMethod:kPOST withBlock:^(NSDictionary *dict, NSError *error) {

        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) {

                        //逻辑判断

                    }

                }

            }

        }

    }];

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。