简体   繁体   English

从iPhone应用程序打开iTunes

[英]Open iTunes from iPhone app

I need to open iTunes app store from my application. 我需要从我的应用程序打开iTunes应用程序商店。 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];
NSURL *url = [NSURL URLWithString:@"itms-apps://itunes.apple.com/us/album/esperanza/id321585893"];
        [[UIApplication sharedApplication] openURL:url];

Not http:// 不是http://

Try this: 尝试这个:

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

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" . 如果您所在的国家/地区不可用,它将显示错误消息“您的请求无法完成”

iPhone support phobos link to open itunes url iPhone支持phobos链接以打开iTunes网址

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. 它不适用于iOS模拟器,仅适用于iPhone。

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

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