iOS检测版本更新

//下面的两个url记得要用https,之前用了http结果获取到的数据是空的,郁闷了好久,**********换成自己的app id就行了
#define     appStoreCheckUrlStr       @"https://itunes.apple.com/cn/lookup?id=**********"  //检测版本用的url
#define     appStoreUrlStr            @"https://itunes.apple.com/cn/app/sagosim/id**********?mt=8"  //跳转Appstore用的url

//获取Appstore上的版本
-(void)getAppStoreVersion
{
    [NetworkUtils httpDoPOST:appStoreCheckUrlStr timeoutInterval:10 parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSArray *infoArray = [responseObject valueForKey:@"results"];
        NSDictionary *infoDict = [infoArray lastObject];
        NSString *iTunesVersion = [infoDict valueForKey:@"version"];
        NSLog(@"最新版本iTunesVersion-->%@",iTunesVersion);
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        NSLog(@"检测app更新请求失败");
    }];
}

你可能感兴趣的:(iOS检测版本更新)