Search code examples
urlitunesaffiliate

how do you open a link to the itunes storefront for browsing the store


I would like to open a link to the iTunes Storefront so that a user can browse the store. In the iPhone Music app, you can click on the "Store" button and get redirected to the music store front. From there, a user can browse the store. I would like to be able to do the same thing, but I don't know the url.

I've tried the obvious link using the following code:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://itunes.apple.com/"]];

but this gives an error stating that the address in invalid. Using phobos.apple.com doesn't give an error, but it doesn't bring anything up in the browser.

If this is possible, then I would preferably like to use an iTunes affiliate link so that I get credit for a purchased song. Is that possible?


Solution

  • Try https://itunes.apple.com/us/store

    However, if you want to work with affiliate links you'll want to take this one step further and resolve the redirects associated with them behind the scenes, before sending the user on (or you get a "stutter step" where the user is sent into the safari app first). That's where you'll want to try something like what we've got on our site:

    http://www.georiot.com/using-georiot/resources/itunes/linking-tools#linking-inside-ios