Velmurugan
Velmurugan

Reputation: 2303

Open iTunes from iPhone app

I need to open iTunes app store from my application. I used the following link. But the error is:

Your Request Could Not Be Completed

My code is as below:

NSString *referralLink = @"http://itunes.apple.com/us/album/esperanza/id321585893";
NSURL *iTunesURL = [NSURL URLWithString:referralLink];
NSURLRequest *referralRequest = [NSURLRequest requestWithURL:iTunesURL];
NSURLConnection *referralConnection = [[NSURLConnection alloc] initWithRequest:referralRequest delegate:self startImmediately:YES];
[referralConnection release];
[[UIApplication sharedApplication] openURL:iTunesURL];

Upvotes: 0

Views: 3123

Answers (4)

user1573162
user1573162

Reputation: 47

iPhone support phobos link to open itunes url

Use this link

NSURL *appStoreUrl = [NSURL URLWithString:@"http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=321585893&mt=8"];
[[UIApplication sharedApplication] openURL:appStoreUrl];

It will not work on iOS simulator.It will only work on iPhone.

Upvotes: 0

jfalexvijay
jfalexvijay

Reputation: 3711

You can use following code.

NSURL *url = [NSURL URLWithString:@"itms-apps://itunes.apple.com/us/album/esperanza/id321585893"];
[[UIApplication sharedApplication] openURL:url];

But it is looking like, the Esperanza Album is available for USA and few specif countries.

If it is not available for your country, it will show the error message "Your request could not be completed".

Upvotes: 0

xuanweng
xuanweng

Reputation: 1939

NSURL *url = [NSURL URLWithString:@"itms-apps://itunes.apple.com/us/album/esperanza/id321585893"];
        [[UIApplication sharedApplication] openURL:url];

Not http://

Upvotes: 3

Amy Worrall
Amy Worrall

Reputation: 16337

Try this:

NSURL *appStoreUrl = [NSURL URLWithString:@"http://itunes.apple.com/us/album/esperanza/id321585893"];
[[UIApplication sharedApplication] openURL:appStoreUrl];

Upvotes: 1

Related Questions