从iPhone应用程序打开iTunes

问题描述:

我需要从我的应用程序打开iTunes应用程序商店。我使用了以下链接。但是,错误的是:从iPhone应用程序打开iTunes

您的请求无法完成

我的代码如下:

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]; 
+0

在这个主题上有一个经典的帖子,所以你不能错过它,http://*.com/questions/818973/iphone-how-can-i-include-a-url-to-my -app-in-the-app – 2011-01-26 09:41:14

试试这个:

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

显示同样的错误...“您的请求无法完成”。 – Velmurugan 2011-01-26 09:50:15

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

不http://

+0

对不起,它也没有工作.. \t 显示同样的错误...“您的请求无法完成”。 - – Velmurugan 2011-01-26 10:10:52

您可以使用以下代码。

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

但它看起来像,Esperanza专辑可用于美国和少数特定国家。

如果它不适用于您所在的国家,它将显示错误信息“您的请求无法完成”

iPhone支持火卫一链接,打开iTunes网址

使用此链接

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

它不会在iOS simulator.It工作仅在iPhone上运行。