iOS獲取 App詳細信息的方法

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

利用 iTunes Search API 獲取 app 信息

其中一種方法是根據(jù) app 的 id 來查找:
http://itunes.apple.com/lookup?id=appId (appId為應用 id)
或者
http://itunes.apple.com/lookup?bundleId=bundleId (bundleId為應用的 BundleId)

回來補坑

如果你的應用是在全世界范圍內銷售的話, 用上面的是沒問題的
但是,如果僅僅是在部分地區(qū), 比如只在中國商店提供下載,就需要在路徑是加上國家的縮寫 cn.
http://itunes.apple.com/cn/lookup?id=appId (appId為應用 id)
同理, 利用 bundleId 獲取也是一樣的, 路徑上需要加上地區(qū) cn.
http://itunes.apple.com/cn/lookup?bundleId=bundleId (bundleId為應用的 BundleId)
否則你將會得到一個 results : [] 的結果

解決問題的原帖地址

返回的json數(shù)據(jù)結構

{
    "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/

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
  • 序言:七十年代末孝偎,一起剝皮案震驚了整個濱河市,隨后出現(xiàn)的幾起案子辕录,更是在濱河造成了極大的恐慌玫鸟,老刑警劉巖退渗,帶你破解...
    沈念sama閱讀 218,122評論 6 505
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件移稳,死亡現(xiàn)場離奇詭異,居然都是意外死亡会油,警方通過查閱死者的電腦和手機个粱,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,070評論 3 395
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來翻翩,“玉大人都许,你說我怎么就攤上這事稻薇。” “怎么了胶征?”我有些...
    開封第一講書人閱讀 164,491評論 0 354
  • 文/不壞的土叔 我叫張陵塞椎,是天一觀的道長。 經(jīng)常有香客問我睛低,道長案狠,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 58,636評論 1 293
  • 正文 為了忘掉前任钱雷,我火速辦了婚禮骂铁,結果婚禮上,老公的妹妹穿的比我還像新娘罩抗。我一直安慰自己拉庵,他們只是感情好,可當我...
    茶點故事閱讀 67,676評論 6 392
  • 文/花漫 我一把揭開白布套蒂。 她就那樣靜靜地躺著钞支,像睡著了一般。 火紅的嫁衣襯著肌膚如雪泣懊。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 51,541評論 1 305
  • 那天麻惶,我揣著相機與錄音馍刮,去河邊找鬼。 笑死窃蹋,一個胖子當著我的面吹牛卡啰,可吹牛的內容都是我干的。 我是一名探鬼主播警没,決...
    沈念sama閱讀 40,292評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼匈辱,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了杀迹?” 一聲冷哼從身側響起亡脸,我...
    開封第一講書人閱讀 39,211評論 0 276
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎树酪,沒想到半個月后浅碾,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 45,655評論 1 314
  • 正文 獨居荒郊野嶺守林人離奇死亡续语,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內容為張勛視角 年9月15日...
    茶點故事閱讀 37,846評論 3 336
  • 正文 我和宋清朗相戀三年垂谢,在試婚紗的時候發(fā)現(xiàn)自己被綠了。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片疮茄。...
    茶點故事閱讀 39,965評論 1 348
  • 序言:一個原本活蹦亂跳的男人離奇死亡滥朱,死狀恐怖根暑,靈堂內的尸體忽然破棺而出,到底是詐尸還是另有隱情徙邻,我是刑警寧澤排嫌,帶...
    沈念sama閱讀 35,684評論 5 347
  • 正文 年R本政府宣布,位于F島的核電站鹃栽,受9級特大地震影響躏率,放射性物質發(fā)生泄漏。R本人自食惡果不足惜民鼓,卻給世界環(huán)境...
    茶點故事閱讀 41,295評論 3 329
  • 文/蒙蒙 一薇芝、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧丰嘉,春花似錦夯到、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,894評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至路幸,卻和暖如春荐开,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背简肴。 一陣腳步聲響...
    開封第一講書人閱讀 33,012評論 1 269
  • 我被黑心中介騙來泰國打工晃听, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人砰识。 一個月前我還...
    沈念sama閱讀 48,126評論 3 370
  • 正文 我出身青樓能扒,卻偏偏與公主長得像,于是被迫代替她去往敵國和親辫狼。 傳聞我的和親對象是個殘疾皇子初斑,可洞房花燭夜當晚...
    茶點故事閱讀 44,914評論 2 355

推薦閱讀更多精彩內容