繁体   English   中英

从iPhone应用程序打开iTunes

[英]Open iTunes from iPhone app

我需要从我的应用程序打开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];
NSURL *url = [NSURL URLWithString:@"itms-apps://itunes.apple.com/us/album/esperanza/id321585893"];
        [[UIApplication sharedApplication] openURL:url];

不是http://

尝试这个:

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

您可以使用以下代码。

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

但看起来,世界语专辑已在美国和少数特定国家/地区推出。

如果您所在的国家/地区不可用,它将显示错误消息“您的请求无法完成”

iPhone支持phobos链接以打开iTunes网址

使用这个连结

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

它不适用于iOS模拟器,仅适用于iPhone。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM