【问题标题】:How Can I Launch The Appstore App Directly from my Application如何直接从我的应用程序启动 Appstore 应用程序
【发布时间】:2008-10-22 18:24:41
【问题描述】:

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

我知道 2.1 中有一个错误会阻止应用商店链接在 safari 中工作,但不知何故人们直接启动了应用商店,甚至通过 safari 也不行。

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

【问题讨论】:

    标签: iphone app-store


    【解决方案1】:

    非常简洁:

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

    如果您想为开发者发送到所有应用,请使用

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

    这些适用于 iOS 4.1

    另请参阅 How to link to apps on the app store

    【讨论】:

      【解决方案2】:

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

      将其放入 NSURL 并在其上调用 openURL。

      【讨论】:

      • 我已经做到了。它不适用于 2.1 固件。您收到“无效的 url”错误。
      • 对我来说很好;在我们的 Crosswords Light 应用程序中,我们使用以下代码行链接到我们的完整版本: [UIApp openURL: [NSURL URLWithString: @"phobos.apple.com/WebObjects/MZStore.woa/wa/…; 我刚刚在 2.1 2G iPhone 上尝试过,效果很好。
      • 我刚刚在调试器中测试了它,并插入了我的实际应用程序并且它正在工作。现在我意识到模拟器上没有“AppStore”应用程序。多哈。感谢您的帮助!
      • 可能相关的问题:stackoverflow.com/questions/818973/819064#819064 为您提供更好的 URL
      • 解决方案先打开 Safari。
      【解决方案3】:

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

      基本上是这样完成的,请随时阅读我的​​博客post

      - (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]];
      }
      

      【讨论】:

      • "itms-apps:" 是必需的 insted "itms:"。
      • 我在别处看到过这篇文章。 type=Purple+Software 应该改吗?
      • @geekinit 不,不要更改“紫色软件”。那是 iPhone 的代号,显然仍被硬编码到系统中。
      【解决方案4】:

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

      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 的 iPhone 上对此进行了测试,并将立即将您重定向到 App Store 应用。

      【讨论】:

        【解决方案5】:

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

        然后拨打UIApplication openURL就可以了。

        【讨论】:

          【解决方案6】:

          确保显示的是“phobos.apple.com”而不是“itunes.apple.com”

          前者直接打开App Store,后者会先打开MobileSafari,再打开App Store。

          【讨论】:

            【解决方案7】:

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

            【讨论】:

              【解决方案8】:

              如果您不想获得 iTunes 的链接,您可以这样做。

              1. 在 AppStore 中选择您的应用
              2. 单击右上角的告诉朋友按钮。
              3. 将链接通过电子邮件发送给自己

              我在 iTunes 链接没有的时候做过这项工作。

              【讨论】:

                【解决方案9】:

                如果你有一个附属链接,并且你想在没有 Safari 的情况下直接打开 App Store 应用程序,你可以使用隐藏的 UIWebView 或 NSURLConnection。对于后者,请参阅此帖子http://gamesfromwithin.com/handling-app-store-and-linkshare-links

                【讨论】:

                  【解决方案10】:

                  这是我使用的代码,并针对提到的各种 iOS 版本对其进行了测试。显然将客户 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]];
                  }
                  

                  【讨论】:

                    【解决方案11】:

                    如果您只是发布应用程序...您还没有“应用程序 ID #”...所以这些方法都不起作用。

                    我必须在我的 v1.0 中插入一个“无效链接”...然后在我的 v1.1 更新中...添加实际链接和应用 ID #。

                    【讨论】:

                    • 您可以在提交二进制文件之前从 iTunesconnect 获取 appid
                    • 此外,您现在可以使用iTunes.com/apps/[yourcompanyname]/[appname],无需 ID。
                    猜你喜欢
                    • 2012-09-02
                    • 2016-06-19
                    • 2012-11-10
                    • 1970-01-01
                    • 1970-01-01
                    • 1970-01-01
                    • 1970-01-01
                    • 2016-10-15
                    • 1970-01-01
                    相关资源
                    最近更新 更多