iOS 9 Universal Links无法从同一域启动应用程序 [英] iOS 9 Universal Links not launching the app from the same domain

查看:148
本文介绍了iOS 9 Universal Links无法从同一域启动应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当有人访问 myDomain.com/ShowInTheApp / *



<我已设置我的AASA JSON文件来打开应用p>这适用于Notes应用程序,电子邮件,Gmail应用程序,Safari网页上的Safari以及任何其他网站myDomain.com。



myDomain时.com / chooseAppORweb.html 包含指向 myDomain.com/ShowInTheApp / 的链接,safari总是在同一个标​​签页中打开它,app不会启动。我可以点击并按住链接以显示上下文菜单,其中包含打开[我的应用程序名称]条目,该条目确实会启动我的应用程序。但不是单击链接。



当我从其他域执行完全相同的步骤时, NOTmyDomain.com/chooseAppORweb.html 总是毫无问题地启动应用程序。



是否有人使用UL成功地从同一域启动应用程序?



此外,如果Apple的文档解释了这些行为,请分享链接。

解决方案

我不确定Apple何时将其添加到他们的文档中,但是在他们的支持通用链接页面,在第一个注释中:


在iOS 9及更高版本中,通用链接允许用户在 WKWebView UIWebView 视图和Safari页面,以及导致调用 openURL:的链接,例如在邮件,消息和其他应用程序中发生的链接。



当用户在Safari中浏览您的网站并点击与当前网页位于同一域中的网址的通用链接时, iOS会尊重用户最可能的意图并开启修改Safari中的链接。如果用户点击其他域中的URL的通用链接,iOS将打开您应用中的链接。



对于用户谁正在运行早于9.0的iOS版本,点击通往您网站的通用链接会打开Safari中的链接。


(强调添加)



基本上,一旦用户在Safari中访问您域中托管的页面,他们在您的域上关注的任何链接都将在Safari中打开,即使它们被定义为您的应用的通用链接。


I have setup my AASA JSON file to open the app when someone visits myDomain.com/ShowInTheApp/*

This works from Notes App, Email, Gmail App, Gmail web on safari and basically any other websites other myDomain.com .

When myDomain.com/chooseAppORweb.html contains a link to myDomain.com/ShowInTheApp/ , safari always opens it in the same tab, app wont get launched. I can tap and hold the link to show the context menu that contains an entry "Open In [My app name]" which will indeed launch my app. But not by single tapping on the link.

When I do the exact same steps from another domain, NOTmyDomain.com/chooseAppORweb.html always launches the app without issues.

Has anyone succeeded in launching the app consistently from the same domain using UL ?

Also, if there is an Apple's document that explains any of these behaviours, please share the link.

解决方案

I'm not sure when Apple added this to their documentation, but it's explained on their Support Universal Links page, in the first note:

In iOS 9 and later, universal links let users open your app when they tap links to your website within WKWebView and UIWebView views and Safari pages, in addition to links that result in a call to openURL:, such as those that occur in Mail, Messages, and other apps.

When a user is browsing your website in Safari and they tap a universal link to a URL in the same domain as the current webpage, iOS respects the user’s most likely intent and opens the link in Safari. If the user taps a universal link to a URL in a different domain, iOS opens the link in your app.

For users who are running versions of iOS earlier than 9.0, tapping a universal link to your website opens the link in Safari.

(Emphasis added)

Essentially, once a user reaches a page hosted on your domain in Safari, any links they follow on your domain will be opened in Safari, even if they're defined as Universal Links by your app.

这篇关于iOS 9 Universal Links无法从同一域启动应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆