我现在已经使用了几个可以直接从应用程序启动 iTunes 商店的应用程序。我什至在我的 2.1 iPod 2G 上使用了一些。

我知道 2.1 中有一个错误,导致应用程序商店链接无法在 safari 中工作,但不知何故,人们直接启动应用程序商店,甚至不通过 safari。

你怎么做到这一点?这是一个未记录的 openURL 功能吗?

有帮助吗?

解决方案

在iTunes中,将应用程序的图标拖到桌面上,这会为您提供一个可以直接使用的链接(例如, http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=284036524&mt=8 在桌面和桌面上启动AppStore到Crosswords一部iPhone)。

将其弹出到NSURL并在其上调用openURL。

其他提示

非常简洁:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"itms://itunes.com/apps/appname"]];

如果您要向开发者发送所有应用,请使用

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"itms://itunes.com/apps/developername"]];

这些适用于iOS 4.1

另见 如何链接到应用商店中的应用

我想出了如何直接进入 AppStore 中应用程序的评论页面。

基本上就是这样完成的,欢迎阅读我的博客 邮政 关于它。

- (IBAction)gotoReviews:(id)sender
{
    NSString *str = @"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa";
    str = [NSString stringWithFormat:@"%@/wa/viewContentsUserReviews?", str]; 
    str = [NSString stringWithFormat:@"%@type=Purple+Software&id=", str];

    // Here is the app id from itunesconnect
    str = [NSString stringWithFormat:@"%@289382458", str]; 

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
}

如果您想显示应用程序的详细信息而不是评论,可以使用以下网址:

NSString *appId    = @"app id";
NSString *endPoint = [NSString stringWithFormat:@"phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=%@&mt=8", appId];
NSString *link     = [NSString stringWithFormat:@"itms-apps://%@", endPoint];

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:link]];

我已经在iOS 6.1上使用iOS 6.1对其进行了测试,并会立即将您重定向到App Store应用程序。

Ben Gottlieb是对的,但有更快的方法来获取网址:您可以右键点击iTunes中的任何应用程序图标,然后选择“复制iTunes Store网址”。

然后在其上调用 UIApplication openURL

确保它说“phobos.apple.com”而不是“itunes.apple.com”

前者直接打开App Store,后者首先打开MobileSafari,然后打开App Store。

您可以从itunesconnect.apple.com“管理您的应用程序”获取您的AppID

如果您不想获取iTunes的链接,可以执行此操作。

  1. 在AppStore中选择您的应用
  2. 点击右上角的“告诉朋友”按钮。
  3. 通过电子邮件发送给自己的链接
  4. 我有这个工作,iTunes链接不会。

如果您有联盟链接,并且您仍希望在没有Safari的情况下直接打开App Store应用程序,则可以使用隐藏的UIWebView或NSURLConnection。对于后者,请参阅 http://gamesfromwithin.com/handling-app-store -and-LinkShare的链接

这是我使用的代码,并针对上面提到的各种iOS版本进行了测试。显然,将客户ID更改为您的客户ID:

- (void)showOurAppsInAppStore
{        
    NSString *searchUrl = nil;
    // iPad
    if ([DeviceController isDeviceAnIpad]) {
        searchUrl = @"itms-apps://itunes.apple.com/us/artist/seligman-ventures-ltd/id326161338";
    }
    // iPhone / iPod Touch
    else {
        // iOS 7+
        if ([DeviceController isDeviceOperatingSystemAtleast:@"7.0"]) {
            searchUrl = @"itms-apps://itunes.apple.com/artist/seligman-ventures-ltd/id326161338";
        }
        // iOS 6
        else if ([DeviceController isDeviceOperatingSystemAtleast:@"6.0"]) {
            searchUrl = @"itms-apps://ax.itunes.apple.com/artist/seligman-ventures-ltd/id326161338";
        }
        // Pre iOS 6
        else {
            NSString *companyName = @"Seligman Ventures";
            searchUrl = [NSString stringWithFormat:@"http://phobos.apple.com/WebObjects/MZSearch.woa/wa/search?WOURLEncoding=ISO8859_1&lang=1&output=lm&country=US&term=%@&media=software", [companyName stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
        }
    }

    [[UIApplication sharedApplication] openURL: [NSURL URLWithString:searchUrl]];
}

如果你刚刚发布你的应用...你将没有“app ID#”但是......所以这些方法都不起作用。

我必须插入“非工作链接”。在我的v1.0中...然后在我的v1.1更新中...添加了实际的链接和应用程序ID#。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top