Could an iOS app get the iTunes link of itself? Is there a documented or undocumented API for this?
Here is the answer.
- The app requests http://itunes.apple.com/lookup?bundleId=com.clickgamer.AngryBirds
- Find the
"version": "2.1.0"
and"trackId": 343200656
in the JSON response.
Warning: This API is undocumented, Apple could change it without notice.
References:
[1] https://github.com/nicklockwood/iVersion/blob/master/iVersion/iVersion.m#L705
[2] https://stackoverflow.com/a/8841636/41948
[3] http://ax.phobos.apple.com.edgesuite.net/WebObjects/MZStoreServices.woa/wa/wsLookup?id=343200656&mt=8
[4] http://itunes.apple.com/WebObjects/MZStoreServices.woa/ws/wsSearch?term=+Angry+Birds&country=US&media=software&entity=softwareDeveloper&limit=6&genreId=&version=2&output=json&callback=jsonp1343116626493
You way use iTunes Search API to look up your and other apps on the App Store.
Example: http://itunes.apple.com/search?media=software&country=us&term=raining%20weather
iTunes may return more then one result, but you can filter results by bundleId
.
trackViewUrl
will contain iTunes URL to your app. trackId
will contain app's ID.
Until your app is approved and published for the first time you cannot get the app store link. I would recommend using bit.ly shorturl with a random link in your app. Once the app is approved you can change the bit.ly destination to the app store link.
来源:https://stackoverflow.com/questions/9717159/get-itunes-app-store-id-of-an-app-itself