我有一个应用程序可以在 UIWebView 中显示网页.它显示的页面可能包含指向 App Store 上其他 iPhone 应用程序的链接.
I have an app that will display web pages within a UIWebView. The pages it shows may contain links to other iPhone apps on the App Store.
在台式计算机上的普通浏览器中,单击这些 App Store 链接将引导我通过一些 URL 重定向,最终打开 iTunes 并将我带到该应用程序的页面.
In a normal browser on a desktop computer, clicking these App Store links would take me through a number of URL redirects and eventually end up opening iTunes and taking me to the page for that App.
有没有办法确保在我的 UIWebView 中点击 App Store 链接时,iPhone 上的 App Store 应用会打开并显示该应用?
Is there a way to ensure that when an App Store link is clicked inside my UIWebView that the App Store app on the iPhone will open and show the app?
我在测试中看到的是,有几种类型的链接可以生成 App Store 页面,它们是:
What I've been seeing in my tests is that there are several types of links that can result in an App Store page, those being:
当我在桌面浏览器中打开这些链接中的任何一个时,它们都会起作用并最终打开 iTunes.当我从 iPhone 中打开这些链接中的任何一个时,UIWebView 会经历许多重定向,最终会发生以下两种情况之一:
When I open any of these links in a desktop browser they will work and eventually open iTunes. When I open any of these links from within the iPhone the UIWebView goes through a number of redirects and eventually one of two things will happen:
我唯一能够打开 App Store 应用程序的方法是使用直接 iTunes 链接到该应用程序,而无需任何推荐或重定向.
The only time I've been able to get the App Store app to open is by using a direct iTunes link to the app without any referral or redirects.
显然,对于推荐或附属链接,我不想去掉推荐 ID 或附属 ID.如果点击的是他们的链接,我不应该剥夺他们的推荐.
Obviously for referral or affiliate links, I do not want to strip out the referral ID or affiliate ID. I shouldn't deprive them of a referral if it was their link that is clicked.
所以任何帮助将不胜感激.
So any help would be greatly appreciated.
谢谢.
我找到了这个技术问答 回答了我的问题:
I found this Technical Q&A from Apple that answers my question:
基本要点是这样的:
正确构建的 phobos.apple.com 链接将直接重定向到 App Store 应用.itunes.apple.com 链接必须转换为 phobos 链接.必须使用 NSURLConnection 遍历推荐/附属链接,最终生成的 URL 将是可以使用的 phobos 链接.
phobos.apple.com links constructed properly will redirect directly to the App Store app. itunes.apple.com links must be converted into phobos links. referral/affiliate links must be traversed using NSURLConnection and the final resulting URL will be a phobos link that can be used.
感谢你们的帮助.
这篇关于从 UIWebView 可靠地打开 App Store 链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!