iTunes api, lookup by bundle ID?

后端 未结 5 760
予麋鹿
予麋鹿 2020-12-01 05:44

Is there any way to use the iTunes API to lookup information based on the unique app bundleId? I have an iphone app, I want to use the API to check to see if the user has th

相关标签:
5条回答
  • 2020-12-01 06:03

    You can use the library, iVersion, to see if the user has the latest version of the app from within the app.

    iVersion

    Library for dynamically checking for updates to Mac/iPhone App Store apps from within the application and notifying users about the new release. Can also notify users about new features in the app the first time they launch after an upgrade.

    https://github.com/nicklockwood/iVersion

    0 讨论(0)
  • 2020-12-01 06:04

    Thanks to all above answers. Here is code in swift 4.2

    guard let info = Bundle.main.infoDictionary,
                let identifier = info["CFBundleIdentifier"] as? String,
          let url = URL(string: "http://itunes.apple.com/lookup?bundleId=\(identifier)") else { return }
        do {
          let data = try Data(contentsOf: url)
          guard let json = try JSONSerialization.jsonObject(with: data, options: [.allowFragments]) as? [String: Any] else {
            return
          }
          if let result = (json["results"] as? [Any])?.first as? [String: Any],
            let version = result["version"] as? String {
            print("version in app store", version)
          }
        } catch let erro as NSError {
          print(erro.description)
        }
    
    0 讨论(0)
  • 2020-12-01 06:15

    Apple has changed their API, and removed the language code from the URL, so you should only the bundleId for the app you are looking for. For example:

    http://itunes.apple.com/lookup?bundleId=com.yelp.yelpiphone

    In addition, you can add the country parameter to the query, to get results for a specific country App Store.

    For example:

    http://itunes.apple.com/lookup?bundleId=com.yelp.yelpiphone&country=de

    The description, user rating and other fields might change between different App Store countries.

    0 讨论(0)
  • 2020-12-01 06:18

    Turns out you can use the 'Apple ID' instead of the bundle ID as it is also unique per app. The 'Apple ID' maps to 'trackId' in http://itunes.apple.com/lookup service.

    0 讨论(0)
  • 2020-12-01 06:23

    You can use a bundle id with Search API. Just replace id with bundleId, like following:

    http://itunes.apple.com/lookup?bundleId=com.facebook.Facebook

    EDIT: As @Roman Blachman stated, the country code logic has changed. If you want to limit your results to a specific country, use the following example.

    http://itunes.apple.com/lookup?bundleId=com.facebook.Facebook&country=us

    0 讨论(0)
提交回复
热议问题