iOS获取 App详细信息的方法

1. 通过info.plist文件中的bundle version中获取:
NSDictionary *infoDic = [[NSBundle mainBundle] infoDictionary];  
    CFShow(infoDic);  
      
NSString *appVersion = [infoDic objectForKey:@"CFBundleShortVersionString"];
// .... 
2. 通过苹果服务器获取

利用 iTunes Search API 获取 app 信息

其中一种方法是根据 app 的 id 来查找:
http://itunes.apple.com/lookup?id=appId (appId为应用 id)
或者
http://itunes.apple.com/lookup?bundleId=bundleId (bundleId为应用的 BundleId)

回来补坑

如果你的应用是在全世界范围内销售的话, 用上面的是没问题的
但是,如果仅仅是在部分地区, 比如只在中国商店提供下载,就需要在路径是加上国家的缩写 cn.
http://itunes.apple.com/cn/lookup?id=appId (appId为应用 id)
同理, 利用 bundleId 获取也是一样的, 路径上需要加上地区 cn.
http://itunes.apple.com/cn/lookup?bundleId=bundleId (bundleId为应用的 BundleId)
否则你将会得到一个 results : [] 的结果

解决问题的原帖地址

返回的json数据结构

{
    "resultCount": 1,
    "results": [
        {
            "ipadScreenshotUrls": [
                "http://a2.mzstatic.com/us/r30/Purple62/v4/31/3b/dd/313bdd53-bf40-4d07-6e08-11e926575348/sc552x414.jpeg",
                "http://a4.mzstatic.com/us/r30/Purple71/v4/20/a2/72/20a27207-ce2d-1069-cc4d-fb550c089d91/sc552x414.jpeg",
                "http://a2.mzstatic.com/us/r30/Purple71/v4/49/7e/af/497eaf80-e64f-8896-c033-25fb90b0f4be/sc552x414.jpeg",
                "http://a5.mzstatic.com/us/r30/Purple62/v4/9a/db/3b/9adb3b9c-3ba3-29e1-db43-628d16dcac91/sc552x414.jpeg",
                "http://a5.mzstatic.com/us/r30/Purple71/v4/19/01/af/1901af49-4678-e985-d967-9a796636c4d6/sc552x414.jpeg"
            ],
            "appletvScreenshotUrls": [],
            "artworkUrl60": "http://is5.mzstatic.com/image/thumb/Purple111/v4/e5/59/03/e55903e7-f8de-c582-7729-f918147018c1/source/60x60bb.jpg",
            "artworkUrl512": "http://is5.mzstatic.com/image/thumb/Purple111/v4/e5/59/03/e55903e7-f8de-c582-7729-f918147018c1/source/512x512bb.jpg",
            "artworkUrl100": "http://is5.mzstatic.com/image/thumb/Purple111/v4/e5/59/03/e55903e7-f8de-c582-7729-f918147018c1/source/100x100bb.jpg",
            "artistViewUrl": "https://itunes.apple.com/us/developer/yelp/id284910353?uo=4",
            "features": [
                "iosUniversal"
            ],
            "kind": "software",
            "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"
            ],
            "screenshotUrls": [
                "http://a1.mzstatic.com/us/r30/Purple62/v4/e9/66/bf/e966bfa0-78c6-739e-a1b2-1d37ea53432f/screen696x696.jpeg",
                "http://a1.mzstatic.com/us/r30/Purple62/v4/45/cf/71/45cf71de-77d9-363a-8100-ade36f9a3a40/screen696x696.jpeg",
                "http://a5.mzstatic.com/us/r30/Purple62/v4/a3/af/ad/a3afadb5-fde5-3ec5-169e-b5131672a28c/screen696x696.jpeg",
                "http://a2.mzstatic.com/us/r30/Purple62/v4/38/fe/a5/38fea567-c499-45a6-a69b-dadc34614ff8/screen696x696.jpeg"
            ],
            "advisories": [
                "Infrequent/Mild Sexual Content and Nudity",
                "Infrequent/Mild Profanity or Crude Humor",
                "Infrequent/Mild Mature/Suggestive Themes",
                "Infrequent/Mild Alcohol, Tobacco, or Drug Use or References"
            ],
            "isGameCenterEnabled": false,
            "languageCodesISO2A": [
                "CS",
                "DA",
                "NL",
                "EN",
                "FI",
                "FR",
                "DE",
                "IT",
                "JA",
                "MS",
                "NB",
                "PL",
                "PT",
                "ZH",
                "ES",
                "SV",
                "ZH",
                "TR"
            ],
            "fileSizeBytes": "169932800",
            "trackCensoredName": "Yelp - Nearby Restaurants, Shopping & Services",
            "contentAdvisoryRating": "12+",
            "averageUserRatingForCurrentVersion": 4.5,
            "userRatingCountForCurrentVersion": 1692,
            "trackViewUrl": "https://itunes.apple.com/us/app/yelp-nearby-restaurants-shopping-services/id284910350?mt=8&uo=4",
            "trackContentRating": "12+",
            "currency": "USD",
            "wrapperType": "software",
            "version": "11.12.0",
            "description": "Yelp has over 100 million reviews of businesses worldwide and is available for iPhone, iPad, and Apple Watch.\n\nWhether you’re looking for a pizzeria that just opened or a coffee shop nearby, Yelp is your local guide to finding the perfect place to eat, shop, drink, relax and play.\n\nYelp features:\n\nFind Restaurants\n• Find the newest and hottest restaurants in your area\n• Make reservations, pick up food and order for delivery, all from your phone\n• Filter restaurant search results by price, location and more\n\nSearch for Nearby Businesses\n• Discover great local businesses\n• Read millions of reviews by the Yelp community\n• Find great deals offered by local businesses\n\nSearch Filters \n• Filter your search results by neighborhood, distance, rating, price and hours of operation\n• Look up addresses and phone numbers, call a business or make reservations directly from the app\n\nOther Features\n• Read expert user reviews and browse through beautiful photos of each business\n• Write and read reviews, check-in to local businesses, upload photos and add tips for other Yelp users\n\nFind local restaurants, read expert customer reviews and start searching for businesses near you with Yelp.\n\nNeed Help? Contact Yelp at https://www.yelp-support.com/?l=en_US\nNote: Continued use of GPS running can dramatically decrease battery life.",
            "artistId": 284910353,
            "artistName": "Yelp",
            "genres": [
                "Travel",
                "Food & Drink"
            ],
            "price": 0,
            "formattedPrice": "Free",
            "trackId": 284910350,
            "trackName": "Yelp - Nearby Restaurants, Shopping & Services",
            "bundleId": "com.yelp.yelpiphone",
            "primaryGenreName": "Travel",
            "isVppDeviceBasedLicensingEnabled": true,
            "releaseDate": "2008-07-11T07:00:00Z",
            "releaseNotes": "Spring’s coming and bugs are coming back in style in the real world, but in the Yelp app they’re going out of style and fast. We fixed a whole bunch.",
            "primaryGenreId": 6003,
            "genreIds": [
                "6003",
                "6023"
            ],
            "sellerName": "Yelp, Inc.",
            "minimumOsVersion": "8.0",
            "currentVersionReleaseDate": "2017-04-05T18:53:21Z",
            "averageUserRating": 4,
            "userRatingCount": 213622
        }
    ]
}

更详细的文档地址:
https://affiliate.itunes.apple.com/resources/documentation/itunes-store-web-service-search-api/

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 212,294评论 6 493
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 90,493评论 3 385
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 157,790评论 0 348
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 56,595评论 1 284
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 65,718评论 6 386
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 49,906评论 1 290
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 39,053评论 3 410
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 37,797评论 0 268
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 44,250评论 1 303
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 36,570评论 2 327
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 38,711评论 1 341
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 34,388评论 4 332
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 40,018评论 3 316
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,796评论 0 21
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,023评论 1 266
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 46,461评论 2 360
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 43,595评论 2 350

推荐阅读更多精彩内容