美文网首页
获取APP Connect的版本信息

获取APP Connect的版本信息

作者: Arthur澪 | 来源:发表于2020-02-17 15:12 被阅读0次
+ (void)getAppStoreInfo:(NSString *)appID success:(void(^)(NSDictionary *))success {
    
    NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://itunes.apple.com/CN/lookup?id=%@",appID]];
    
    [[[NSURLSession sharedSession] dataTaskWithURL:url completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
        dispatch_async(dispatch_get_main_queue(), ^{
            if (error == nil && data != nil && data.length > 0) {
                NSDictionary *respDict = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
                if (success) {
                    success(respDict);
                }
            }
        });
    }] resume];
    
}
  • 返回的json数据结构:
{
    "resultCount": 1,
    "results": [{
        "isGameCenterEnabled": false,
        "screenshotUrls": ["https://is1-ssl.mzstatic.com/image/thumb/Purple123/v4/e3/f1/f9/e3f1f927-49c6-da67-c056-587b2dc1eaaf/pr_source.png/392x696bb.png", "https://is3-ssl.mzstatic.com/image/thumb/Purple123/v4/a9/c4/31/a9c4310b-e13a-8c50-6023-06baa5b8bf9b/pr_source.png/392x696bb.png", "https://is5-ssl.mzstatic.com/image/thumb/Purple113/v4/b4/83/f8/b483f8a9-05aa-ab78-3b0a-596598f7c357/pr_source.png/392x696bb.png"],
        "ipadScreenshotUrls": [],
        "appletvScreenshotUrls": [],
        "artworkUrl60": "https://is4-ssl.mzstatic.com/image/thumb/Purple123/v4/7e/ac/a3/7eaca34e-4348-79fb-dbb5-0aa816df4651/source/60x60bb.jpg",
        "artworkUrl512": "https://is4-ssl.mzstatic.com/image/thumb/Purple123/v4/7e/ac/a3/7eaca34e-4348-79fb-dbb5-0aa816df4651/source/512x512bb.jpg",
        "artworkUrl100": "https://is4-ssl.mzstatic.com/image/thumb/Purple123/v4/7e/ac/a3/7eaca34e-4348-79fb-dbb5-0aa816df4651/source/100x100bb.jpg",
        "artistViewUrl": "https://apps.apple.com/cn/developer/quanzhou-yan-zi-nerwork-technology-co-ltd/id1469773135?uo=4",
        "supportedDevices": ["iPad2Wifi-iPad2Wifi", "iPad23G-iPad23G", "iPhone4S-iPhone4S", "iPadThirdGen-iPadThirdGen", "iPadThirdGen4G-iPadThirdGen4G", "iPhone5-iPhone5", "iPodTouchFifthGen-iPodTouchFifthGen", "iPadFourthGen-iPadFourthGen", "iPadFourthGen4G-iPadFourthGen4G", "iPadMini-iPadMini", "iPadMini4G-iPadMini4G", "iPhone5c-iPhone5c", "iPhone5s-iPhone5s", "iPadAir-iPadAir", "iPadAirCellular-iPadAirCellular", "iPadMiniRetina-iPadMiniRetina", "iPadMiniRetinaCellular-iPadMiniRetinaCellular", "iPhone6-iPhone6", "iPhone6Plus-iPhone6Plus", "iPadAir2-iPadAir2", "iPadAir2Cellular-iPadAir2Cellular", "iPadMini3-iPadMini3", "iPadMini3Cellular-iPadMini3Cellular", "iPodTouchSixthGen-iPodTouchSixthGen", "iPhone6s-iPhone6s", "iPhone6sPlus-iPhone6sPlus", "iPadMini4-iPadMini4", "iPadMini4Cellular-iPadMini4Cellular", "iPadPro-iPadPro", "iPadProCellular-iPadProCellular", "iPadPro97-iPadPro97", "iPadPro97Cellular-iPadPro97Cellular", "iPhoneSE-iPhoneSE", "iPhone7-iPhone7", "iPhone7Plus-iPhone7Plus", "iPad611-iPad611", "iPad612-iPad612", "iPad71-iPad71", "iPad72-iPad72", "iPad73-iPad73", "iPad74-iPad74", "iPhone8-iPhone8", "iPhone8Plus-iPhone8Plus", "iPhoneX-iPhoneX", "iPad75-iPad75", "iPad76-iPad76", "iPhoneXS-iPhoneXS", "iPhoneXSMax-iPhoneXSMax", "iPhoneXR-iPhoneXR", "iPad812-iPad812", "iPad834-iPad834", "iPad856-iPad856", "iPad878-iPad878", "iPadMini5-iPadMini5", "iPadMini5Cellular-iPadMini5Cellular", "iPadAir3-iPadAir3", "iPadAir3Cellular-iPadAir3Cellular", "iPodTouchSeventhGen-iPodTouchSeventhGen", "iPhone11-iPhone11", "iPhone11Pro-iPhone11Pro", "iPadSeventhGen-iPadSeventhGen", "iPadSeventhGenCellular-iPadSeventhGenCellular", "iPhone11ProMax-iPhone11ProMax"],
        "advisories": [],
        "kind": "software",
        "features": [],
        "trackCensoredName": "乐包车",
        "languageCodesISO2A": ["ZH"],
        "fileSizeBytes": "54536192",
        "contentAdvisoryRating": "4+",
        "trackViewUrl": "https://apps.apple.com/cn/app/%E4%B9%90%E5%8C%85%E8%BD%A6/id1469773286?uo=4",
        "trackContentRating": "4+",
        "trackName": "乐包车",
        "trackId": 1469773286,
        "releaseDate": "2019-09-23T21:12:12Z",
        "currentVersionReleaseDate": "2020-01-19T22:04:18Z",
        "releaseNotes": "1.新增春节红包,让春节接单更快捷;2.新增高速计价补偿费",
        "isVppDeviceBasedLicensingEnabled": true,
        "primaryGenreName": "Travel",
        "genreIds": ["6003"],
        "formattedPrice": "免费",
        "primaryGenreId": 6003,
        "sellerName": "Quanzhou Yan Zi Network Technology Co., Ltd.",
        "minimumOsVersion": "9.0",
        "currency": "CNY",
        "version": "1.0.9",
        "wrapperType": "software",
        "artistId": 1469773135,
        "artistName": "Quanzhou Yan Zi Nerwork Technology Co., Ltd.",
        "genres": ["旅游"],
        "price": 0.00,
        "description": "乐包车是针对7-55座的包车平台。。。",
        "bundleId": "com.lebaoche.passenger"
    }]
}

判断版本是否更新

//  判断 APP版本 是否更新
+(BOOL)needVersionUpdateTo:(NSString *)appStoreEdition {
    // 本地版本
    NSDictionary * infoDic = [[NSBundle mainBundle] infoDictionary];
    NSString * locatedVersionString = [infoDic objectForKey:@"CFBundleShortVersionString"];  // app 版本
     
    if([locatedVersionString compare:appStoreEdition] == NSOrderedDescending ||
       [locatedVersionString compare:appStoreEdition] == NSOrderedSame  )
    {
        return NO;
    } else {
        return YES;
    }
}

相关文章

网友评论

      本文标题:获取APP Connect的版本信息

      本文链接:https://www.haomeiwen.com/subject/lrorhqtx.html