views:

124

answers:

2

Im trying to implement button which opens app store application from my app. I use this simple line of code, which opens safari but not app store application.

[[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"http://itunes.apple.com/sk/app/tweetie-2/id333903271?mt=8"]];

I dont know whats wrong, is the URL format correct? I was following this document.

All related questions in stackoverflow are outofdate I suppose.

A: 

According to the documentation, iTunes affiliate links have to process several redirects in order to wind up in iTunes. Follow the example to create an NSURLConnection, set yourself as its delegate, and use the string it ends up with to open with UIApplication.

Jeff Kelley
A: 

If you want to bypass Safari, change 'itunes' in the URL to 'phobos'. Note that this will fail in the simulator, but most definitely works on the device.

CrystalSkull