derek5. 2009-01-11 22:48 采纳率: 100%
浏览 550
已采纳

如何在应用商店链接应用

I am creating a free version of my iPhone game. I want to have a button inside the free version that takes people to the paid version in the app store. If I use a standard link

http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=300136119&mt=8

the iPhone opens Safari first, and then the app store. I have used other apps that open the app store directly, so I know it is possible.

Any ideas? What is the URL Scheme for the app store?

转载于:https://stackoverflow.com/questions/433907/how-to-link-to-apps-on-the-app-store

  • 写回答

22条回答 默认 最新

  • YaoRaoLov 2010-02-25 21:03
    关注

    Edited on 2016-02-02

    Starting from iOS 6 SKStoreProductViewController class was introduced. You can link an app without leaving your app. Code snippet in Swift 3.x/2.x and Objective-C is here.

    A SKStoreProductViewController object presents a store that allows the user to purchase other media from the App Store. For example, your app might display the store to allow the user to purchase another app.


    From News and Announcement For Apple Developers.

    Drive Customers Directly to Your App on the App Store with iTunes Links With iTunes links you can provide your customers with an easy way to access your apps on the App Store directly from your website or marketing campaigns. Creating an iTunes link is simple and can be made to direct customers to either a single app, all your apps, or to a specific app with your company name specified.

    To send customers to a specific application: http://itunes.com/apps/appname

    To send customers to a list of apps you have on the App Store: http://itunes.com/apps/developername

    To send customers to a specific app with your company name included in the URL: http://itunes.com/apps/developername/appname


    Additional notes:

    You can replace http:// with itms:// or itms-apps:// to avoid redirects.

    For info on naming, see Apple QA1633:

    https://developer.apple.com/library/content/qa/qa1633/_index.html.

    Edit (as of January 2015):

    itunes.com/apps links should be updated to appstore.com/apps. See QA1633 above, which has been updated. A new QA1629 suggests these steps and code for launching the store from an app:

    1. Launch iTunes on your computer.
    2. Search for the item you want to link to.
    3. Right-click or control-click on the item's name in iTunes, then choose "Copy iTunes Store URL" from the pop-up menu.
    4. In your application, create an NSURL object with the copied iTunes URL, then pass this object to UIApplication' s openURL: method to open your item in the App Store.

    Sample code:

    NSString *iTunesLink = @"itms://itunes.apple.com/us/app/apple-store/id375380948?mt=8";
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:iTunesLink]];
    

    Swift 3.0

       let urlStr = "itms://itunes.apple.com/us/app/apple-store/id375380948?mt=8"
        if #available(iOS 10.0, *) {
            UIApplication.shared.open(URL(string: urlStr)!, options: [:], completionHandler: nil)
    
        } else {
            UIApplication.shared.openURL(URL(string: urlStr)!)
        }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(21条)

报告相同问题?

悬赏问题

  • ¥170 如图所示配置eNSP
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改
  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持
  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果
  • ¥15 键盘指令混乱情况下的启动盘系统重装