iOS9:Universal Links不起作用 [英] iOS9: Universal Links does not work

查看:573
本文介绍了iOS9:Universal Links不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我按照教程 https://blog.branch.io/how-to-setup-universal-links-to-deep-link-on-apple-ios-9 并使用与提供的值完全相同的值。



Apple Association文件也在链接目录中准备就绪:
WEB_PAGE:PORT_NUMBER / apple-app-site-association



这一切似乎都设置好了。



我已经添加了权利,更新了配置文件,以及所有设置。



当我在我的设备上运行应用程序时,打开链接 http:// WEB_PAGE :PORT_NUMBER ,这总是打开Safari。



我甚至在以下方法中有断点:

   - (BOOL)应用程序:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void(^)(NSArray * __nu llable restorableObjects))restorationHandler 

但是zilch。



<有没有人完善过这个?我错过了什么吗?

解决方案

有一些可能的问题。


  1. 尝试将您的域名粘贴到此链接验证程序中,并确保没有问题: https:// limitless- sierra-4673.herokuapp.com/ (感谢ShortStuffSushi - 请参阅 repo


  2. 如果您没有在权利中指定的域上正确设置TLS,则iOS会在系统日志中记录错误消息。它隐藏在操作系统日志中,而不是应用程序日志中。错误信息将如下所示 Sep 21 14:27:01 Derricks-iPhone swcd [2044]< Notice>:2015-09-21 02:27:01.878907 PM [SWC] ###拒绝网址'https://examplecustomdomain.com/apple-app-site-association'用于auth方法'NSURLAuthenticationMethodServerTrust': - 6754 / 0xFFFFE59E kAuthenticationErr 。从此处提取的错误消息,有关使用CloudFlare for TLS的快速(不完整)说明在哪里


  3. 在我的个人测试,点击/输入Safari中的链接从未直接打开过应用程序。点击其他应用程序(iMessage,Mail,Slack等)已经工作。其他人报告说,点击Google搜索结果中的链接会直接打开该应用。


  4. 请注意,如果Universal Link成功打开您的应用,然后您点击到Safari(通过点击应用中导航栏右上角的网站),然后 iOS会在您访问该网址时停止打开该应用。然后在Safari中,您可以向下拉以在打开页面顶部显示横幅。 我浪费了很多时间。请注意,根据您在apple-app中指定的路径,点击进入网站=>停用UL似乎路径特定站点关联文件。因此,如果您有单独的路线, yoursite.com/a / * yoursite.com/b / * ,如果你点击 yoursite.com/a / * 然后直接打开你的应用程序,你可以在应用程序的右上角选择点击 yoursite.com/a / * 。如果您这样做,后续访问 yoursite.com/a / * 将在浏览器中打开,而不是应用程序。但是, yoursite.com/b / * 应该不受影响,仍然可以直接打开您的应用。


如果您发现问题所在,请告诉我。我个人非常好奇Universal Links如何工作以及存在哪些边缘情况。祝你好运。


So I followed the tutorial https://blog.branch.io/how-to-setup-universal-links-to-deep-link-on-apple-ios-9 and exactly use the same values as the one provided.

The Apple Association file is also ready in the link directory: WEB_PAGE:PORT_NUMBER/apple-app-site-association

Everything seems to be setup on this side.

I've added the entitlements, updated the provisioning profile, and everything's setup.

When I run the app on my device, and open the link http://WEB_PAGE:PORT_NUMBER, this always opens Safari.

I even have breakpoints in the following methods:

- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void(^)(NSArray * __nullable restorableObjects))restorationHandler

But zilch.

Has anyone perfected this? Is there something I missed out?

解决方案

There are a few possible issues.

  1. Try pasting your domain into this link validator and make sure there are no issues: https://limitless-sierra-4673.herokuapp.com/ (credit to ShortStuffSushi -- see repo)

  2. iOS logs an error message in the system logs if you don't have TLS set up properly on the domain specified in your entitlements. It's buried in the OS logs, not application logs. The error message will look like Sep 21 14:27:01 Derricks-iPhone swcd[2044] <Notice>: 2015-09-21 02:27:01.878907 PM [SWC] ### Rejecting URL 'https://examplecustomdomain.com/apple-app-site-association' for auth method 'NSURLAuthenticationMethodServerTrust': -6754/0xFFFFE59E kAuthenticationErr. Error message pulled from here, quick (incomplete) instructions on using CloudFlare for TLS here.

  3. In my personal testing, clicking/typing in a link in Safari has never once opened the app directly. Clicking from other apps (iMessage, Mail, Slack, etc.) has worked. Others have reported that clicking links in Google search results have opened the app directly.

  4. Note that if a Universal Link succeeds in opening your app and then you click through to Safari (by tapping your site in the top right corner of the nav bar in app), then iOS stops opening the app when you visit that URL. Then in Safari, you can pull down to reveal a banner at the top of the page with "Open". I wasted a lot of time on this. Note that clicking through to the site => disabling UL seems path specific, based on the paths you specify in the apple-app-site-assocation file. So if you have separate routes, yoursite.com/a/* and yoursite.com/b/*, if you click yoursite.com/a/* and it opens your app directly, you then have the option in the top right corner of the app to click through to yoursite.com/a/*. If you do that, subsequent visits to yoursite.com/a/* will open in browser, not app. However, yoursite.com/b/* should be unaffected and still open your app directly.

Let me know if you discover what the issue is. I'm personally very curious about how Universal Links work and what edge cases exist. Good luck.

这篇关于iOS9:Universal Links不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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