I'm creating an iOS radio station app, and I can't find a solution to what I thought was a simple problem. If my radio station plays an song/album people want to buy, how can I just launch the iTunes Store and have it open with a search results for that track or album?
I know I can use the Apple Search API to get a json of the search results and parse that for the best search results, and I know I can open the iTunes store with https://itunes.apple.com/ (if I try to append a search string to this, I get the metadata back) or with SKStoreProductViewController if I know the product ID.
But is there a way to simply open the iTunes Store to open with search results for a song or album (or both) without having to evaluate the search metadata and send them to one (perhaps wrong) product?
Thanks!
You can do this using URL Scheme's and a tool called iTunes Link Maker. Documentation can be found for iTunes on Apple's website here
The iTunes URL scheme is used to link to content on the iTunes Music
Store. The iTunes URL format is complicated to construct, so you
create it using an online tool called iTunes Link Maker. The tool
allows you to select a country destination and media type, and then
search by song, album, or artist. After you select the item you want
to link to, it generates the corresponding URL.
http://linkmaker.itunes.apple.com/
Related
Following this question we can get a JSON response from the iTunes Search API to direct users to the trackViewUrl. The answer suggested appending &app=itunes to have the iOS device open the URL in the iTunes Store instead of Apple Music, but my test suggests that this doesn't work and Apple Music is still opened.
For instance, the first item of the result of:
https://itunes.apple.com/search?term=pink+floyd%20high%20hopes
shows a trackViewUrl of:
https://music.apple.com/us/album/high-hopes/1067444712?i=1067444898&uo=4,
with the appended request is:
https://music.apple.com/us/album/high-hopes/1067444712?i=1067444898&uo=4&app=itunes
However, this link opens Apple Music on an iOS device.
Is there a way to open the iTunes Store instead? Or another way to open the iTunes Store to a specific track? I need DRM free tracks.
The correct way of doing this now is with StoreKit.
I would like to ask if you know where to find API for the App Store search tab. I mean that tab, where I can put the specific keyword and the API, will show me auto suggestions for this word.
Information about the App Store Search API can be found at:
iTunes Search API Documentation
The Search API allows you to place search fields in your website to
search for content within the iTunes Store, App Store, iBooks Store
and Mac App Store. You can search for a variety of content; including
apps, iBooks, movies, podcasts, music, music videos, audiobooks, and
TV shows.
Look up example for Yelp by app ID:
https://itunes.apple.com/lookup?id=284910350
Search example for an app titled “Yelp” in the US App Store:
https://itunes.apple.com/search?term=yelp&country=us&entity=software
I have an app that plays music and I need to implement iTunes search. So, for example, I need to find song by Pink Floyd called Time. How can I open iTunes Store on iOS with results of search query "Pink Floyd - Time"?
I know it's possible, since there is an app in App Store, called VK App, a client for social network that does exactly that.
And do I need to somehow request approval of this function by Apple?
For loading dynamically you can use like this example, it will open the itunes store with the searched item: #"itms://phobos.apple.com/WebObjects/MZSearch.woa/wa/advancedSearchResults?artistTerm=pink%20floyd&songTerm=High%20Hopes"
Also, you can perform a search and parse the result (a json) to provide a more specific link using this web service:
https://itunes.apple.com/search?term=pink+floyd%20high%20hopes
Here is the link for the API: http://www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.html
I am using the second approach on one of my app's. Works good
Wish it helps
Apple has a link maker designed to do just that.
Here's the link to it.
hi my app has links to an itunes music album
like this
http://itunes.apple.com/us/album/better-than-a-hallelujah/id366013643?i=366013659&ign-mpt=uo%3D4
when they click the link in my app, i want to open it in my app (i have a uiwebview), problem is that it launches the uiwebview in my app, but the page is blank, the address bar is also blank, i.e. it doesn't contain the address http://itunes.apple.com/us/album/better-than-a-hallelujah/id366013643?i=366013659&ign-mpt=uo%3D4
i think it is because it is trying to launch the itunes app in the simulator/device
but i don't care, i want the http://itunes.apple.com/us/album/better-than-a-hallelujah/id366013643?i=366013659&ign-mpt=uo%3D4 to load in the browser and display the content like you would in the desktop browser.
please help thanks
As I got from your question, you need to display the album data in your app. For doing that I suggest you two ways.
First solution is to use NSURLRequest with the url and download it's data and load the html in the webview. (you may change the User-Agent too if you wanted to get the desktop version of the page.
The second one is using iTunes API to get album data from iTunes Store as JSON and then display the data in your custom view.
You can get more information on iTunes Store API here
Hope it helps. :)
I have an app that interacts with both the iPod player, and the iTunes Store Web Service Search API. Is there a way to obtain the iTunes ID for a song that I retrieve from my user's iPod library (e.g. via MPMusicPlayerController, or MPMediaItem)?
The documentation says that the MPMediaItemPropertyPersistentID is a unique identifier that persists across app launch. This however, seems like it might be a unique local id.
The only solution I can think of is to retrieve the song title and artist from MPMediaItem, then query iTunes to obtain the iTunes ID. Is the iTunes ID stored anywhere locally within the iPod library?
Thanks - I am pretty new to the media framework.
The API documentation does not list a property for MPMediaItem that gives the iTunes Song ID, but it does give all of the information about a song such as the Artist and song name so, as you suggested, you could search the store for that criteria.