从iTunes获取App信息

1. 根据APP的BundleId从iTunes获取版本信息对比更新

以BundleId获取APP信息:https://itunes.apple.com/lookup?bundleId=你APP的Bundle ID
返回的信息中包括版本号、trackId(即iTunes id)、更新信息、屏幕截图等。
使用这个接口,可以在APP一开始就部署更新机制,未上架时请求返回的数据是:

{
 "resultCount":0,
 "results": []
}

上架后可以根据results里的version字段值,比较后提示更新。此方法也适用于多个APP共用同一套代码的情况。

{
 "resultCount":1,
 "results": [
    {
    ... 
    "version":"2.9.0", 
    "currentVersionReleaseDate":"2017-06-14T06:16:08Z", 
    "bundleId":"com.xxx.x", 
    ...
    }
    ]
}

2. 根据APP的id从iTunes获取版本信息,对比更新

http://itunes.apple.com/cn/lookup?id=(YourAppID)适用在中国范围发布
http://itunes.apple.com/lookup?id=(YourAppID)适用其他
e.g: http://itunes.apple.com/cn/lookup?id=1062207166
初版发布后可以从iTunes获取id,后面的版本根据id请求版本信息,与当前版本对比,提示更新

{
    "resultCount": 1,
    "results": [
        {
            "artistViewUrl": "https://itunes.apple.com/cn/developer/puhui-zhongjia/id1062207165?uo=4",
            "artworkUrl60": "http://is5.mzstatic.com/image/thumb/Purple69/v4/a9/8b/0e/a98b0e82-8c0e-5fbf-a04a-939284442d1c/source/60x60bb.jpg",
            "artworkUrl100": "http://is5.mzstatic.com/image/thumb/Purple69/v4/a9/8b/0e/a98b0e82-8c0e-5fbf-a04a-939284442d1c/source/100x100bb.jpg",
            "screenshotUrls": [
                "http://a4.mzstatic.com/us/r30/Purple69/v4/ff/b9/58/ffb9584d-9bcb-8124-2772-b8d8bad3468d/screen1136x1136.jpeg",
                "http://a1.mzstatic.com/us/r30/Purple49/v4/a5/24/69/a5246911-0134-6689-c682-328ec0e1c762/screen1136x1136.jpeg",
                "http://a4.mzstatic.com/us/r30/Purple49/v4/55/3e/63/553e63ae-b0c8-08fb-08bf-3d72ebadf806/screen1136x1136.jpeg",
                "http://a3.mzstatic.com/us/r30/Purple49/v4/d1/47/6f/d1476f40-c7b2-0a90-ec39-45b44b0c15f1/screen1136x1136.jpeg"
            ],
            "ipadScreenshotUrls": [
                "http://a3.mzstatic.com/us/r30/Purple49/v4/3c/43/02/3c4302ec-71f3-db30-d6a1-fbb47f4b4a7f/screen480x480.jpeg",
                "http://a4.mzstatic.com/us/r30/Purple49/v4/e5/e8/7d/e5e87d99-481f-02dc-9181-b1dc6cb3ac2f/screen480x480.jpeg"
            ],
            "artworkUrl512": "http://is5.mzstatic.com/image/thumb/Purple69/v4/a9/8b/0e/a98b0e82-8c0e-5fbf-a04a-939284442d1c/source/512x512bb.jpg",
            "kind": "software",
            "features": [
                "iosUniversal"
            ],
            "supportedDevices": [
                "iPhone4",
                "iPad2Wifi",
                "iPad23G",
                "iPhone4S",
                "iPadThirdGen",
                "iPadThirdGen4G",
                "iPhone5",
                "iPodTouchFifthGen",
                "iPadFourthGen",
                "iPadFourthGen4G",
                "iPadMini",
                "iPadMini4G",
                "iPhone5c",
                "iPhone5s",
                "iPhone6",
                "iPhone6Plus",
                "iPodTouchSixthGen"
            ],
            "advisories": [
                "偶尔/轻度医药/医疗信息",
                "无限制网页访问"
            ],
            "isGameCenterEnabled": false,
            "trackCensoredName": "慧众家",
            "trackViewUrl": "https://itunes.apple.com/cn/app/hui-zhong-jia/id1062207166?mt=8&uo=4",
            "contentAdvisoryRating": "17+",
            "languageCodesISO2A": [
                "EN",
                "ZH"
            ],
            "fileSizeBytes": "20395330",
            "trackContentRating": "17+",
            "formattedPrice": "免费",
            "currency": "CNY",
            "wrapperType": "software",
            "version": "2.3.84",
            "description": "厦门普慧众佳文化科技有限公司秉着普技能、慧生活的经营理念,引进港台地区及国际先进的家庭服务教育思维,创立“闽台家庭服务人才实训基地”设有育婴员、家政服务员、养老护理员等多个家庭服务职业工种系统性学习课程,侧重于技能实操教学;首创“慧众家”职业教育在线学习平台,主要包含网上注册报名;课程管理;整合多种格式的知识、信息资源;学习评估、结果跟踪、生成学习报告等功能;通过BBS,实训基地面授培训等方式提供学员与学员、学员与讲师间的交互沟通渠道;旨在传递,跟踪,报告和管理学习内容,掌握学习进度,提高学习效率,力求学以致用;专注于培养家庭服务业实用性人才,推动行业标准化建设与服务的健康发展!",
            "artistId": 1062207165,
            "artistName": "puhui zhongjia",
            "genres": [
                "教育"
            ],
            "price": 0,
            "trackName": "慧众家",
            "trackId": 1062207166,
            "bundleId": "com.PHZJ.htlhzj",
            "releaseDate": "2016-01-07T23:16:40Z",
            "primaryGenreName": "Education",
            "primaryGenreId": 6017,
            "isVppDeviceBasedLicensingEnabled": true,
            "releaseNotes": "新增培训课程,记录您的学习进度,下次学过的内容再也不用重头再看一遍啦!",
            "currentVersionReleaseDate": "2016-02-02T02:38:09Z",
            "sellerName": "puhui zhongjia",
            "genreIds": [
                "6017"
            ],
            "minimumOsVersion": "7.0"
        }
    ]
}

你可能感兴趣的:(从iTunes获取App信息)