iOS 9 Universal Links not launching the app from the same domain

天大地大妈咪最大 提交于 2019-12-18 17:01:05

问题


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.


回答1:


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.




回答2:


As st.derrick mentioned above, this is the in-place behavior for Universal links. If you have previously been taken to the App from the link, but then choose to be taken to the website when prompted with a long press, the functionality to open the App will break. You can remedy this by long-pressing again and choosing to open in-app. It's not an ideal solution, but it is the only way I've seen it be fixed. I hope this helps!



来源:https://stackoverflow.com/questions/33554973/ios-9-universal-links-not-launching-the-app-from-the-same-domain

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!