iOS通用链接未在应用内打开 [英] iOS Universal Links are not opening in-app
问题描述
因此,我完全遵循了本教程,并使用与提供的值相同的值: https://blog .branch.io/如何设置通用链接到苹果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
Apple Association文件也位于链接目录中:
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
可是.
有人完善了吗?有什么我想念的吗?
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中,当您添加关联的域"权利时,每个条目都必须以
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屋!