Apple Universal Links
概述
Branch 使得使用 Universal Links 变得更加简单,同时提供全面归因,支持个别案例情况,并在用户没有安装应用时允许您进行深度链接。

设置 Universal Links
-
To get started, you’ll need to enable Universal Links on the Branch dashboard. To do this:
a. Navigate to Configuration page in the Branch Dashboard.
b. Check the box to Enable Universal Links from iOS redirects.
c. Type in your App’s Bundle Identifier. (Learn more on this page )
d. Type in your Apple App Prefix (found by clicking your app on this page in Apple's Developer Portal).
e. Scroll down and click on the Save button. -
From here, you’ll enable Associated Domains in Xcode by:
a. Go to the Capabilities tab of your project file.
b. Scroll down and enable Associated Domains.
c. If you see an error after this step, please check that:- 为您的 Xcode 项目选择了合适的团队。
- Xcode 项目的捆绑包标识符与用于向 Apple 注册应用标识符的捆绑包标识符匹配。
-
Add your Branch link domains by:
a. On the Configuration page, find the Link Domain section.
b. Copying your domain name.
c. In the Domains section, click the + icon and add the following entries: (making sure that xxxx matches the subdomain prefix you've been assigned or selected for yourself)- applinks:xxxx.app.link
- applinks:xxxx-alternate.app.link
- applinks:xxxx.test-app.link
- applinks:xxxx-alternate.test-app.link
支持旧版链接
If the Default domain name box shows the legacy
bnc.lt
domain, you should use the following entry instead:applinks:bnc.lt
使用自定义域还是子域?
If you use a custom domain or subdomain for your Branch links, you should instead add entries for
applinks:[mycustomdomainorsubdomain]
,XXXX.app.link
andXXXX-alternate.app.link
. If you're unsure of your Branch-assigned app.link subdomain, contact our support team, and we can provide it.
支持 Universal Links 的应用/浏览器
Universal Links 不可用。我们在这里汇总了一些热门应用的 Universal Links 支持状态。
始终有效的应用
如果您在以下应用之一中打开 Universal Link,应该可以一直正常工作:
- Messages
- Gmail
- Inbox
Apple 限制的应用
Apple 在某些情况下限制了 Universal Links:
- 如果将链接粘贴到浏览器 URL 字段中,则 Universal Link 将不起作用。
- Universal Links will not work with a user-driven
<a href="...">
element click on the same domain. For example, if there is a Universal Link on google.com pointing to a different Universal Link on google.com, it will not open the app. - Universal Links cannot be triggered via Javascript (in
window.onload
or via a.click()
call on an<a>
element) unless it is part of a user action.
Apps/Browsers that work conditionally:
- Safari
- Chrome
有时可以运行的应用
Apps with built-in webviews (Google, Twitter, Facebook, Facebook Messenger, WeChat, etc.) work with Universal Links only when a webview is already open. In other words, Universal Links do not work in-app from the feed or main app views.
To work around this limitation, your links must have Deepviews or something similar enabled, with a call-to-action link or button with a Universal Link behind it. This way, clicking a link from the app feed will open a webview containing your Deepview page, and the user can then click the link/button to launch your app. All of Apple's limitations (in the section above) still apply for the Deepview page.
Apps/Browsers that work conditionally:
- Facebook Messenger
- Any app using
SFSafariViewController
具有特殊情况的应用
如果配置为在 Safari 中打开链接,则 Slack 可以工作。否则,它会像上述部分一样有条件地工作。
无法使用的应用
- Telegram
导致 Universal Links 失败的常见问题
您是否通过手动进入 Safari 进行测试?
进入 Safari 时,Universal Links 无法正常工作。使用 Notes 或 iMessage 进行测试。您是否将 Branch Links 与另一个链接一起包装并重定向?
在大多数情况下,通过点击追踪链接将 Universal Links "包裹"时,Universal Links 不会打开该应用。Universal Links(包括 Branch Link)必须是独立的。如果您希望 Universal Links 在所有情况下都能正常工作,请不要使用其他重定向到 Branch Link 的链接。您的 Team ID & Bundle ID 与您操作后台 (Dashboard)上的 ID 匹配吗?
You can find them in the Dashboard on the [Configuration](dashboard.branch.io/configuration/general) page, in the iOS section next to "Enable Universal Links." They should match your Team ID and Bundle ID. Team ID can be found here https://developer.apple.com/membercenter/index.action#accountSummary. Your Bundle ID is found in Xcode, in the **General** tab for the correct build target. If your Apple App Prefix is different from your Team ID, you should use your App Prefix. Your app prefix can be found from App IDs on Apple's Developer Portal.您是否删除了该应用并重新安装?
除非您删除并重新安装该应用,否则 iOS 不会重新抓取 apple-app-site-association 文件。 (唯一的例外是 App Store 更新。iOS 会在每次更新时重新抓取。这意味着,当用户使用授权的应用链接更新到您的应用版本时,Universal Links 将开始工作。)Universal Links 可以禁用
如果您通过 Universal Link 成功进入了您的应用,则在状态栏的右上角看到 "app.link " (或您的域)和一个 forward 键。如果您点击该键,Apple 将不再激活 Universal Link。要重新启用 Universal Link,请长按“消息”(由于10中的 iMessage 改进而仅限 iOS 9)或 Notes(iOS 10/9)中的链接,然后选择 'Open in APP'。使用自定义域?
Make sure it's configured correctly. The following error message will appear in your OS-level logs if your domain doesn't have SSL set up properly:Sep 21 14:27:01 Derricks-iPhone swcd[2044] : 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
前往 Window > Devices >选择您的设备,然后点击主视图左下角的 "up" 箭头,可以找到连接到 Xcode 的设备的日志。
If you're using a custom subdomain, your CNAME should point to custom.bnc.lt
under Configuration in the Branch dashboard.
Updated 3 months ago