iOS 通用链接未在应用内打开 [英] iOS Universal Links are not opening in-app
问题描述
所以我完全遵循本教程并使用与提供的值相同的值:https://blog.branch.io/how-to-setup-universal-links-to-deep-link-on-apple-ios-9
So I followed this tutorial exactly and use the same values as the ones provided: https://blog.branch.io/how-to-setup-universal-links-to-deep-link-on-apple-ios-9
链接目录中的苹果协会文件也准备好了:WEB_PAGE:PORT_NUMBER/apple-app-site-association
The Apple Association file is also ready in the link directory:
WEB_PAGE:PORT_NUMBER/apple-app-site-association
似乎一切都在这一边.
我已经添加了权限,更新了配置文件,一切都设置好了.
I've added the entitlements, updated the provisioning profile, and everything's set up.
当我在设备上运行该应用程序并打开链接 http://WEB_PAGE:PORT_NUMBER
时,这始终会打开 Safari.
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 method:
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void(^)(NSArray * __nullable restorableObjects))restorationHandler
但是zilch.
有人完善过这个吗?有什么我想念的吗?
Has anyone perfected this? Is there something I'm missing?
推荐答案
有很多方法可能会出错.两点给我带来了麻烦:
There are a lot of ways this can go wrong. Two points caused me trouble:
在 Xcode 中,当您添加 Associated Domains 权利时,每个条目都需要以
applinks:
开头,然后是您的域名.例如.applinks:www.apple.com
.
In Xcode, when you add the Associated Domains entitlement, each entry needs to start with
applinks:
and then your domain name. E.g.applinks:www.apple.com
.
虽然 Xcode 为我创建了一个权利文件,但它没有包含在我的构建中:我必须手动单击该框.
Though Xcode created an entitlements file for me, it did not include in my build: I had to click that box manually.
是的,在这样做之后,就没有必要对 apple-app-site-association
文件进行签名:它只是纯文本,只要它被提供,它就可以工作HTTPS.(不过,如果您支持 iOS 8,您仍然需要签名.)
And yes, after doing that, it wasn't necessary to sign the apple-app-site-association
file: it is just plain text, and it works, as long as it's served over HTTPS. (You'll still need to sign it if you're supporting iOS 8, though.)
这篇关于iOS 通用链接未在应用内打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!