Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
465 views
in Technique[技术] by (71.8m points)

ios - 如何链接到应用商店中的应用(How to link to apps on the app store)

I am creating a free version of my iPhone game.

(我正在创建我的iPhone游戏的免费版本。)

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

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

the iPhone opens Safari first, and then the app store.

(iPhone首先打开Safari,然后打开应用程序商店。)

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?

(应用商店的URL方案是什么?)

  ask by community wiki translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Edited on 2016-02-02

(编辑于2016-02-02)

Starting from iOS 6 SKStoreProductViewController class was introduced.

(从iOS 6开始,介绍了SKStoreProductViewController类。)

You can link an app without leaving your app.

(您可以在不离开应用的情况下关联应用。)

Code snippet in Swift 3.x/2.x and Objective-C is here .

(Swift 3.x / 2.xObjective-C中的代码片段就在这里 。)

A SKStoreProductViewController object presents a store that allows the user to purchase other media from the App Store.

(SKStoreProductViewController对象提供了一个商店,允许用户从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 .

(来自Apple开发者的新闻和公告 。)

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.

(使用iTunes链接在App Store上直接将您的应用程序驱动到您的应用程序通过iTunes链接,您可以直接从您的网站或营销活动中为您的客户提供在App Store上访问您的应用程序的简便方法。)

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.

(创建iTunes链接非常简单,可以将客户引导到单个应用程序,所有应用程序或指定公司名称的特定应用程序。)

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

(要将客户发送到特定应用程序: http//itunes.com/apps/appname)

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

(要将客户发送到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

(要将客户发送到包含在URL中的公司名称的特定应用程序: http//itunes.com/apps/developername/appname)


Additional notes:

(补充说明:)

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

(您可以使用itms://itms-apps://替换http:// itms-apps://以避免重定向。)

Please note that itms:// will send the user to the iTunes store and itms-apps:// with send them to the App Store!

(请注意 itms://会将用户发送到iTunes商店itms-apps://并将其发送到App Store!)

For info on naming, see Apple QA1633:

(有关命名的信息,请参阅Apple QA1633:)

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

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

Edit (as of January 2015):

(编辑(截至2015年1月):)

itunes.com/apps links should be updated to appstore.com/apps.

(itunes.com/apps链接应更新为appstore.com/apps。)

See QA1633 above, which has been updated.

(见上面的QA1633,已经更新。)

A new QA1629 suggests these steps and code for launching the store from an app:

(新的QA1629建议从应用程序启动商店的这些步骤和代码:)

  1. Launch iTunes on your computer.

    (在您的计算机上启动iTunes。)

  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.

    (右键单击或按住Control键并单击iTunes中项目的名称,然后从弹出菜单中选择“复制iTunes Store URL”。)

  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.

    (在您的应用程序中,使用复制的iTunes URL创建NSURL对象,然后将此对象传递给UIApplicationopenURL :方法,以在App Store中打开您的项目。)

Sample code:

(示例代码:)

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

Swift 4.2

(Swift 4.2)

   let urlStr = "itms-apps://itunes.apple.com/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)!)
    }

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...