跳至主要内容

iOS Universal Links

苹果官方链接
原文链接

Overview

Branch makes it simple to enable Universal Links all while greatly improving on them, offering full attribution, supporting edge cases where Universal Links fail (common) and allowing you to deep link when the user doesn't have your app installed.
image

Setup

  1. Navigate to Link Settings in the Branch Dashboard.
  2. Check the box to Enable Universal Links from iOS redirects.
  3. Type in your App’s Bundle Identifier.
  4. Type in your Apple App Prefix (found by clicking your app on this page in Apple's Developer Portal).
  5. Scroll down and click on the Save button.
image

Enable Associated Domains in Xcode

  1. Go to the Capabilities tab of your project file.
  2. Scroll down and enable Associated Domainsimage
If you see an error after this step
image
Please ensure...
  • The right team selected for your Xcode project.
  • The Bundle Identifier of your Xcode project matches the one used to register the App Identifier with Apple.
  1. Go to the Link Settings page on the dashboard.
  2. Scroll down to the Link Domain area.
  3. Copy your domain name.image
  4. 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
image
Support for legacy links
If the Default domain name box shows the legacy bnc.lt domain, you should use the following entry instead: applinks:bnc.lt
Using a custom domain or subdomain?
If you use a custom domain or subdomain for your Branch links, you should instead add entries for applinks:[mycustomdomainorsubdomain] and XXXX-alternate.app.link. If you're unsure of your Branch-assigned app.link subdomain, contact integrations@branch.io, and we can provide it.

Advanced

Unfortunately Universal Links don't work everywhere yet. We have compiled the Universal Links support status of some of the more popular apps.

Apps that always work

If you open a Universal Link in one of these apps, it should work correctly all the time.
App/BrowserStatus
Messagesworks
Mailworks
WhatsAppworks
Gmailworks
Inboxworks

Apps limited by Apple

Apple has limited Universal Links in certain situations, apparently to avoid confusing users:
  • Universal Links will not work if you paste the link into the browser URL field.
  • Universal Links work with a user driven <a href="..."> element click across domains. Example: if there is a Universal Link on google.com pointing to bnc.lt, it will open the app.
  • Universal Links will not work with a user driven <a href="..."> element click on the same domain. 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.
App/BrowserStatus
Safariworks conditionally
Chromeworks conditionally

Apps that work sometimes

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/button that has 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.
App/BrowserStatus
Googleworks conditionally
Facebookworks conditionally
Facebook Messengerworks conditionally
WeChatworks conditionally
Twitterworks conditionally
LinkedInworks conditionally
Any app using SFSafariViewControllerworks conditionally

Apps with special cases

App/BrowserStatus
Slackworks if configured to open links in Safari. Otherwise, works conditionally as in the above section.

Apps that do not work

App/BrowserStatus
Pinterestbroken
Instagrambroken
Telegrambroken
Automated Validation for Your Xcode Project
You can check if your Xcode project is correctly configured by using our Universal Links Validator.
Are you testing by manually entering into Safari?
Universal Links don't work properly when entered into Safari. Use Notes or iMessage for testing.
In most cases, Universal Links won't open the app when they are "wrapped" by click tracking links. Universal links, including Branch links, must be freestanding. If you want Universal Links to work in all situations, do not use other links that redirect to your Branch links.
Do your Team ID & Bundle ID match those on your dashboard?
You can find them in the Dashboard under Settings > Link Settings, 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.
Have you deleted the app and reinstalled it?
iOS does not re-scrape the apple-app-site-association file unless you delete and reinstall the app. (The only exception to this is App Store updates. iOS does rescrape on every update. This means that when users update to a version of your app with the applinks entitlement, Universal Links will start working for them.)
If you are successfully taken into your app via a Universal Link, you'll see "app.link" (or your domain) and a forward button in the top right corner of the status bar. If you click that button, Apple will no longer activate Universal Links in the future. To re-enable Universal Links, long press on the link in Messages (iOS 9 only due to iMessage revamp in 10) or Notes (iOS 10/9) and choose 'Open in <>'.
Using a custom domain?
Make sure it's configured correctly. You can find configuration issues by using our Universal Link Validator.
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] <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
These logs can be found for physical devices connected to Xcode by navigating to Window > Devices > choosing your device and then clicking the "up" arrow in the bottom left corner of the main view.
If you're using a custom subdomain, your CNAME should point to custom.bnc.lt under Link Settings in the Branch dashboard.

Return YES to continueUserActivity

When users enter your app via a Universal Link, we check to see to see if the link URL contains bnc.lt. If so, handledByBranch will return YES. If not, handledByBranch will return NO. This allows us to explicitly confirm the incoming link is from Branch without making a server call.
For most implementations this will never be an issue, since your deep links will be routed correctly either way. However, if you use a custom link domain and you rely on handledByBranch to return YES for every incoming Branch-generated Universal Link, you can inform the Branch SDK by following these steps:
  1. In your Info.plist file, create a new key called branch_universal_link_domains.
  2. Add your custom domain(s) as a string. image
  3. Save the file.
Multiple custom domains
If you have an unusual situation with multiple custom link domains, you may also configure branch_universal_link_domains as an array of strings. image

评论

此博客中的热门博文

Resolving errSecInternalComponent errors during code signing

原文链接 One code signing issue I commonly see, both here on DevForums and in my Day Job™ with DTS, is that the codesign command fails with errSecInternalComponent. This issue crops up in a wide variety of circumstances and the correct fix depends on the specific problem. This post is my attempt to clarify the potential causes of this error and help folks resolve it. If you have any questions or comments about this, please start a new thread, tagging it with Code Signing so that I see it. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = "eskimo" + "1" + "@" + "apple.com" Resolving errSecInternalComponent errors during code signing In some circumstances the codesign command might fail with the error errSecInternalComponent. For example: % codesign -s "Apple Development" "MyTrue" MyTrue: errSecInternalComponent This typically affects folks who are signing code in a nonstandard environm...

iOS:检测使用VPN或Proxy

参考链接: https://www.jianshu.com/p/c3b950dbf86a https://gist.github.com/PramodJoshi/4faad4c91f7dcb4eb9b06be8390c01db http://noodlecode.net/2018/04/check-if-ios-app-is-connected-to-vpn 第一种方法 需要导入框架CFNetwork 然后,这个方法是mrc的:需要添加-fno-objc-arc的flag 代码如下: + ( BOOL )getProxyStatus { NSDictionary *proxySettings = NSMakeCollectable ([( NSDictionary *) CFNetworkCopySystemProxySettings () autorelease]); NSArray *proxies = NSMakeCollectable ([( NSArray *) CFNetworkCopyProxiesForURL (( CFURLRef )[ NSURL URLWithString: @"http://www.google.com" ], ( CFDictionaryRef )proxySettings) autorelease]); NSDictionary *settings = [proxies objectAtIndex: 0 ]; NSLog ( @"host=%@" , [settings objectForKey:( NSString *)kCFProxyHostNameKey]); NSLog ( @"port=%@" , [settings objectForKey:( NSString *)kCFProxyPortNumberKey]); NSLog ( @"type=%@" , [settings objectForKey:( NSString *)kCFProxyTypeKey]); if ([[settings object...

去广告DNS设置,国内ADGuard DNS方案,手机电脑iOS去广告,保护隐私

 原文链接 之前分享过使用mac系统搭建adguard home,这几个月用下来零零散散基本上也被弃用了。主要原因是因为需要保持电脑一直开机。但是我的电脑是笔记本,存在移动各个地域的情况,也就是说只能够屏蔽电脑自身,对于手机而言不太现实。今天偶然发现dnspod推出了高级版的公共解析。dnspod背靠腾讯云,肯定是合法合规的公共解析服务,这个高级版用起来不错。 国内自己搭建解析服务是违法行为,所以这也是为什么使用dnspod的原因。 后台截图 开始使用 首先我们先进入dnspod的公共解析页面,点击开始使用。 专业版公共解析 dnspod会提供几种预设,我们选择「开发者」即可 开发者 然后你就成功的申请到自己个人使用的dns了! 更新拦截规则 我们可以将常见的广告过滤规则加入到dns中。我们在顶部选项卡中选择「拦截规则」。 拦截规则设置 打开adguard adguard 绑定iOS设备 推荐使用描述文件的方式,删除配置时删除描述文件即可。 描述文件 绑定macOS 推荐使用描述文件的方式,删除配置时删除描述文件即可。 描述文件 mac需要在「系统偏好设置」的「网络」中查看是否正在运行。 代理 如果没有运行需要点击「···」来启动服务。 启动服务 绑定路由器 找到自己路由器的DHCP设置,修改dns,然后记得绑定自己的ip。 修改dns 绑定ip 费用 目前有300万次/月的免费额度,但没有超出之后的价格。300万次一个人比较难用完,可以放心使用。 我个人使用iOS设备两台、智能家居、电脑两台,日均请求数大致2万/日。 判断是否搭建成功 可以通过查看日志的方式,日志大概有半小时到一小时的延迟,请耐心等待。