天道酬勤,学无止境

iOS Associated Domains (Universal Links) with Wildcards not working

In an iOS app I am working on I have setup Associated Domains (Universal Links). The app hosts multiple domains. Some domains I have set up with a wildcard. These domains do not seem to work. For example, I want to link to https://news.mydomain.com/. If I add the following to the list of associated domains:

applinks:*.mydomain.com -> Does not work

applinks:news.mydomain.com -> works fine

So I believe I did set up all correct, the apple-app-site-association file is setup fine. I can even see in both cases (using Charles Proxy) the apple-app-site-association file got retrieved ok.

In the case of the wildcard, the link only opens in Safari.

When I configure the domain without a wildcard, the App opens.

Am I missing something here? I am running iOS 9.3.2 on the device and I am running Xcode 7.3.1 which are today the latest versions.

评论

I added my findings to this thread: https://forums.developer.apple.com/thread/47315

In short, even in iOS 10, it appears that the wildcard setup requires that the apple-app-site-association file be served by the wildcard's root.

For instance, if you want to use *.domain.com, then the apple-app-site-association needs to be hosted at both, e.g., app1.domain.com and domain.com, else it won't work with simply specifying applinks:*.domain.com in Xcode.

This is unfortunate if your main site is hosted at www.domain.com, and that you have a 301 redirect on domain.com (which redirects you to www.domain.com), because Universal Links do not allow redirects.

The workaround I found was to create a main subdomain for your app, and to use sub-subdomains for the wildcard. E.g.

  • app.domain.com (must serve the apple-app-site-association file)
  • server1.app.domain.com (must serve the apple-app-site-association)
  • server2.app.domain.com (...)

That way, in Xcode, you may only specify applinks:*.app.domain.com and Universal Links will work without you having to specify server1.app.domain.com, server2.app.domain.com, and so on... in Xcode.

Note, however, that you must also explicitly specify applinks:app.domain.com if you plan on using that server as well with your app.

I hope this helps.

It seems that adding a wildcard in the domain part of the applinks has only been introduced in iOS 9.3 Beta 2. In 9.3 Beta 2 release notes:

You can now use Universal Links with arbitrary subdomains instead of needing to list all of the app’s subdomains as fully qualified domain names. Entries have the form:

:[:port number] in which is “webcredentials”, “activitycontinuation”, or “applinks”.

The part of the entry can now optionally be prefixed with “*.” to indicate a wildcard subdomain. For example:

applinks:*.example.com

You say that you run on iOS 9.3.2. But is your deployment target >= iOS 9.3 ? If it's not: try by changing it. I think it will solve your issue.

Here you can found a copy of this release notes (sorry, I do not have any other public source)

Edit:

Even if the Apple Doc say that you can use wildcards on domains, they seems to have an issue on this:

To match all subdomains of an associated domain, you can specify a wildcard by prefixing . before the beginning of a specific domain (the period is required). Domain matching is based on the longest substring in the applinks entries. For example, if you specify the entries applinks:.mywebsite.com and applinks:*.users.mywebsite.com, matching for the domain emily.users.mywebsite.com is performed against the longer *.users.mywebsite.com entry. Note that an entry for *.mywebsite.com does not match mywebsite.com because of the period after the asterisk. To enable matching for both *.mywebsite.com and mywebsite.com, you need to provide a separate applinks entry for each.

I think it is apple bug in documentation. I got same error on 9.3.1. And 9.3.2 works fine. Very interesting link, about signing problems, see Laurence Fan's comment

Apple should say that *.domain.com works for >= 9.3.2 in this link Support Universal Links

I tried this in Sept 2016, with both iOS 9.3.5 and iOS 10 beta. Situation appears unchanged: universal links are still not working if applinks contains only wildcard domains, even though the documentation suggests that this should work.

Apple have change in AASA file to support Dynamic link please change and add also in Assciate domain : webcredentials:dev.rlogical.com

{
  "applinks": {
      "details": [
           {
             "appIDs": [ "ABCDE12345.com.example.app", "ABCDE12345.com.example.app2" ],
             "components": [
               {
                  "#": "no_universal_links",
                  "exclude": true,
                  "comment": "Matches any URL whose fragment equals no_universal_links and instructs the system not to open it as a universal link"
               },
               {
                  "/": "/buy/*",
                  "comment": "Matches any URL whose path starts with /buy/"
               },
               {
                  "/": "/help/website/*",
                  "exclude": true,
                  "comment": "Matches any URL whose path starts with /help/website/ and instructs the system not to open it as a universal link"
               },
               {
                  "/": "/help/*",
                  "?": { "articleNumber": "????" },
                  "comment": "Matches any URL whose path starts with /help/ and which has a query item with name 'articleNumber' and a value of exactly 4 characters"
               }
             ]
           }
       ]
   },
   "webcredentials": {
      "apps": [ "ABCDE12345.com.example.app" ]
   },
    "appclips": {
        "apps": ["ABCED12345.com.example.MyApp.Clip"]
    }
}

受限制的 HTML

  • 允许的HTML标签:<a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • 自动断行和分段。
  • 网页和电子邮件地址自动转换为链接。

相关推荐
  • Universal links 使用
    从外部跳转到APP内部有两种方式 1、Universal Links 2、schema 一、Universal Links tips: 这个文章是给已经创建有现成的app的开发者看的,如果没有创建app,请先去创建app。 工作原理: 在安装某个app的时候,iOS系统会检查App bundle中的Info.plist文件。如果发现有associated domain字段,会读取applinks的地址,比如wx.shunliandongli.com,然后系统会去该域名根目录下寻找一个名为apple-app-site-association的文件。如果有,那么下载到本地,然后解析这个文件。根据path建立与appid的映射关系,保存在系统的数据库中。如果有访问http://wx.shunliandongli.com/path/ 的链接,系统会根据映射关系找到的appid,启动该app,实现universal link。 1、客户端配置(根据下图配置) image.png image.png image.png 创建Domains 中 applinks: 是固定前缀。后面跟着的是你们的要使用的域名,这样客户端就配置好了(xcode 帮你把appID中的 Associated Domains开关打开了,不需要你处理) 2、服务端配置 在你刚刚添加Associated Domains的域名
  • iOS 通用链接(Universal Link)唤起APP
    APP端的配置 Xcode 11.0以下的 在Target ->Capabilities中,打开Associated Domains配置在Associated Domains中配置,支持的域名,在配置时,必须是applinks: 开头,比如:支持的域名是meilikongjian.resolr.com,需要配置的写法:applinks:meilikongjian.resolr.com Xcode 11.0以上的 ,工程配置中相应功能:targets->Signing&Capabilites->Capability->Associated Domains,在其中的Domains中填入你想支持的域名,也必须必须以applinks:为前缀。 在APPdelegate中的处理判断, - (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler { if ([userActivity.activityType isEqual
  • 可以在iOS中处理您自己的http URL方案吗?(Possible to handle your own http URL schemes in iOS?)
    问题 iOS上的iTunes,App Store和YouTube明确注册了http:// ... URL方案以打开其应用程序。 任何人都可以做到这一点,而不仅仅是您自己的协议? 我想这样做的原因是我正在为节日制作应用程序。 我想“拦截”到网站上特定页面的链接,并启动该应用程序(如果已安装)。 到目前为止,我还没有很多运气 回答1 您可以对“ http://” URL(以及我认为Apple和Spotify所做的)执行此操作的方法是: 像其他答案一样注册一个自定义URL方案。 设置您的HTTP URL指向真实的网页。 如果在iOS上,则在该页面上放置一个脚本以重定向到您的自定义URL。 例如,以下示例页面将带您进入特定用户的Twitter应用程序或Twitter网站,具体取决于您是在网络上还是在iOS设备上: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Twitter</title> </head> <body> <script type="text/javascript"> var username = document.location.search.substr(1); document.location.replace( "standalone" in window.navigator ?
  • 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 Apple Association文件也可以在链接目录中找到: WEB_PAGE:PORT_NUMBER/apple-app-site-association 一切似乎都在这一方面进行了设置。 我已经添加了权利,更新了配置文件,并进行了所有设置。 当我在设备上运行该应用程序并打开链接http://WEB_PAGE:PORT_NUMBER ,这始终会打开Safari。 我甚至在以下方法中都有断点: - (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void(^)(NSArray * __nullable restorableObjects))restorationHandler 但是zilch。 有人完善了吗? 有什么我想念的吗? 回答1 有一些可能的问题。 尝试将您的域粘贴到此链接验证器中,并确保没有问题:https://limitless-sierra-4673
  • Deeplink solution for IOS and Android apps works in Facebook
    There are too much Deep Linking (Universal Links or App Links) tutorials. But most of them shows how to enable it in Android or IOS Apps. Also there are paid cloud solutions but they offer to much features. But there are three main problems I faced in real life: Some browsers doesn’t allow App Links to work. For example you can configure http://example.com to be caught in app, but if this link is clicked by user through Facebook app it is not handled, and Facebook browser shows the web site. There is no unique standard solution to handle links both for Android and IOS apps. No practical
  • 适用于IOS和Android应用程序的Deeplink解决方案可在Facebook中使用(Deeplink solution for IOS and Android apps works in Facebook)
    问题 深层链接(通用链接或应用程序链接)教程过多。 但是其中大多数都显示了如何在Android或IOS Apps中启用它。 也有付费的云解决方案,但它们提供了许多功能。 但是我在现实生活中面临三个主要问题: 某些浏览器不允许应用链接。 例如,您可以将http://example.com配置为在应用程序中捕获,但是如果用户通过Facebook应用程序单击此链接,则该链接不会被处理,Facebook浏览器将显示该网站。 没有独特的标准解决方案可同时处理Android和IOS应用程序的链接。 如果未在移动设备上安装该应用程序,并且用户单击了应用程序链接,则没有实际的解决方案。 我写了这个问答集,这是我的研究结果(花费了太多时间),以致于没有一个独特且适用于所有情况的解决方案。 这些代码来自我的工作解决方案,但是我删除了一些部分只是为了展示这个想法。 如果有一些编译问题,请遵循算法并编写自己的代码 这是解决方案,即使您知道一些步骤,也要逐步进行,因为代码中有技巧。 另外,一些解释在代码部分的注释行中,请阅读它们。 示例是通过您的Android和IOS应用程序处理深度链接http://example.com/v/,并在末尾加一个参数,例如http://example.com/v/id-of-user?key=value。 1.配置Android 1
  • 如何在iOS App和设置服务器中支持通用链接?(How to support Universal Links in iOS App and setup server for it?)
    问题 我如何在我的iOS应用程序中支持通用链接并设置服务器以支持通用链接? 回答1 支持通用链接 当您支持通用链接时,iOS 9用户可以点击指向您网站的链接,并无缝链接到您已安装的应用程序,而无需通过Safari。 如果未安装您的应用程序,请点击指向您网站的链接以在Safari中打开您的网站。 在这里,如何设置自己的服务器,以及如何处理应用程序中的相应链接。 设定伺服器 您需要使服务器在线运行。 为了将iOS应用与服务器安全关联,Apple要求您提供一个名为apple-app-site-association的配置文件。 这是一个描述域和支持的路由的JSON文件。 需要在https:// {domain} / apple-app-site-association上通过HTTPS访问apple-app-site-association文件,而无需任何重定向。 该文件如下所示: { "applinks": { "apps": [ ], "details": [ { "appID": "{app_prefix}.{app_identifier}", "paths": [ "/path/to/content", "/path/to/other/*", "NOT /path/to/exclude" ] }, { "appID": "TeamID.BundleID2", "paths": [
  • 错误:Phonegap中的白名单拒绝(Error: Whitelist rejection in Phonegap)
    问题 我是移动开发的新手。 我正在使用Phonegap / Cordova创建跨平台应用程序。 我的代码在Android上运行良好,但是当我将其移植到iPhone时,它显示了一个错误: [143:2003] ERROR whitelist rejection: url="abc" 现在我可以解决这个问题了吗? 回答1 注意:此答案仅适用于PhoneGap 1.x及更低版本。 从版本2.x开始,通过cordova.xml完成白名单配置。 您必须将允许的URL添加到PhoneGap.plist(或Cordova.plist)的ExternalHosts数组中。 例如,如果要允许访问此URL http://www.myhost.com/path/file ,则将www.myhost.com作为新条目添加到ExternalHosts数组。 如果您想允许访问Google所有子域中的内容(例如maps.google.com , mails.google.com ),则可以将*.google.com作为新条目添加到ExternalHosts数组中。 不过,我不确定为什么您会在链接中得到“ abc”。 您是否有“ abc”作为任何链接? 是URI片段吗? 回答2 在PhoneGap 3.0中,您需要在Project文件夹中编辑config.xml(注意:不是www / config.xml)
  • DDD学习笔记 - 基础篇(Ⅰ)
    最近在自学DDD(领域驱动设计),打算将学习笔记以博客的形式记录下来。 --------------------------------------------------------------------------------------------------------------------------- 领域驱动设计DDD 开篇词 作为中台,需要将通用的可复用的业务能力沉淀到中台业务模型,实现企业级能力复用。 早在2003年就诞生的DDD,怎么来指导迟到近20年才大热的微服务设计呢? 1.搞清楚DDD的核心设计思想,DDD、微服务和中台的关系: 中台本质是业务模型,微服务是业务模型的系统落地方案,DDD是一种设计思想,它可以同时指导中台业务建模和微服务设计,他们之间是铁三角关系。 DDD强调领域模型和微服务设计的一体性,现有领域模型然后才有微服务。 2.战略设计。建立领域模型、划分为服务边界。关键 3.战术设计。从领域模型转向微服务设计和落地。 术语多且陌生。 DDD必知必会十大概念、微服务架构分层、代码模型设计、DDD战略设计、事件风暴、领域建模、企业级中台业务建模。走一遍DDD战略设计和战术设计的全流程,DDD在领域模型和微服务设计过程中的技术要点。深化微服务设计原则、建立演进式微服务架构。 基础篇:领域、子域、核心域、通用域、支撑域、限界上下文、实体、值对象
  • Universal Links not working on iOS10
    Just updated my iPhone to iOS10 and the Universal links stopped working. If I run my app in an iPhone with iOS9, or lower, the Universal Links work fine, but the are just not working at all in iOS10. Any clues?
  • 如何在Google+墙上发布(How to post in Google+ wall)
    问题 我想在我的应用程序中分享Google+墙中的一些信息。 为此,我通过了Google+ API。 在该API中,他们提到了如何获取特定用户的访问令牌,但没有提及如何使用访问令牌在用户墙上发布消息。 回答1 嗯,Google +没有“墙”,而是有“信息流”。 适当的术语可能会帮助您找到更好的搜索结果。 无论哪种方式,除非您是Google合作伙伴,否则新闻都不是好消息: 该API当前仅限于只读访问。 从API网站: 注意:Google+ API当前提供对公共数据的只读访问权限。 所有API调用都需要OAuth 2.0令牌或API密钥。 因为它是只读的,所以您将无法通过API在任何地方更新或发布任何信息-您只能使用它来提取基本信息,例如个人资料和活动详细信息。 鉴于对API的访问可能会随时间而变化,因此,我将尝试通过有关新闻或与写访问相关的更改的信息来使此答案保持最新。 新闻与更新 2015-04-28 :Google+ Domains API早在2013年8月就已宣布,但不知何故我错过了它与Google+的相关性。 Google+域API允许Google Apps客户和ISV利用增强的Google+ API来构建可通过多种方式使用的工具和服务。 不,它不提供用户的Google+个人资料完全写入访问,但它确实让你在Google+的API V1小的优势,在域内至少。
  • 通用选择器对性能有何影响?(What is the performance impact of the universal selector?)
    问题 我试图在一个页面中找到一些简单的客户端性能调整,该页面每月接收数百万的页面浏览量。 我关心的一个问题是CSS通用选择器( * )的使用。 例如,考虑一个非常简单的HTML文档,如下所示: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>Example</title> <style type="text/css"> * { margin: 0; padding: 0; } </head> <body> <h1>This is a heading</h1> <p>This is a paragraph of text.</p> </body> </html> 通用选择器会将以上声明应用于body , h1和p元素,因为它们是文档中唯一的那些元素。 总的来说,我会从以下规则中看到更好的性能: body, h1, p
  • native Domino links and XPages
    Users open documents by links in old format http://server/db.nsf/VIEW_UNID/DOC_UNID. The form has property set to open XPage instead. Origin of these links is email notification generated by "universal agent". It simply sends link to document. It does not know, what form is associated with what XPage, therefore it generates universal links instead of "/page.xsp&documentId=...". The problem: relative links computed at client do not work - < a href = "/page.xsp?params"> should be more effective - no roundtrip and easy to compute at page load. They evaluate to http://server/db.nsf/0/page.xsp
  • Universal Link broken in iOS 11.2
    I am using Branch deep links in an app for sharing links to content in the app via social media. Everything was working fine quite a while. When updating to iOS 11.2 I encountered the following behavior: 1) After the update the Universal Links still worked. 2) I uninstalled the app and reinstalled it. 3) Since then, all links always open the Branch deep view in Safari. 4) Tapping "Open The App", opens the AppStore. It does not matter in which app I tap on the link (Notes, WhatsApp, Messages, Facebook, ...), it is always the same behavior. The Universal Link was not bypassed by tapping the "go
  • 本机Domino链接和XPages(native Domino links and XPages)
    问题 用户通过旧格式的链接打开文档http://server/db.nsf/VIEW_UNID/DOC_UNID 。 表单的属性设置为打开XPage。 这些链接的来源是“通用代理”生成的电子邮件通知。 它只是将链接发送到文档。 它不知道什么格式与什么XPage关联,因此它生成通用链接而不是“ /page.xsp&documentId = ...”。 问题:在客户端计算的相对链接不起作用- < a href = "/page.xsp?params">应该更有效-没有往返,并且在页面加载时易于计算。 他们评估为http://server/db.nsf/0/page.xsp?params ,自然以错误404结尾。 XPage包含“帮助”部分,这是另一个带有RT字段的文档,其中包含文本,图像和链接。 当从另一个XPage-视图(/page.xsp)打开XPage时,该RT字段中的相对链接将起作用,但是当从通知链接(/ 0 / UNID)重定向时,该相对链接将失败。 问题:通过老式URL打开重定向的文档/视图后,如何有效地将浏览器的地址栏重置为扩展的XPages格式http://server/db.nsf/page.xsp?documentId=DOC_UNID ? 回答1 主要问题在于服务器端(在SSJS中评估)和客户端(由浏览器评估)中相对链接的差异。
  • Universal links on iOS vs. deep links (URL schemes)
    As I'm reading, iOS 9 introduced Universal Links. In the "Support Universal Links" section in Apple's App Search Programming Guide, it says that this is not exactly like deep linking with URL schemes, but I'm not totally clear about this topic: What is actually the difference(s) between Universal Link and the URL Schemes? Is it that a Universal Link is only for hyperlinks in websites, and the Mail or Messages apps? Do Universal Links replace URL schemes? Are Universal Links a type of deep link?
  • iOS Universal Links and URL Shorteners
    We have recently begin to encounter issues with our Universal Link implementation when the UL is accessed via a shortened goo.gl URL. This Works: https://site.domain.com/Deep/Link This does not: https://goo .gl/fake -> 302 Redirect -> https://site.domain.com/Deep/Link Is anyone else experiencing the same thing? Note: I had to break up the shortened Google URL to keep StackOverflow's editor from yelling at me.
  • iOS Universal Links are not opening in-app
    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 The Apple Association file is also ready in the link directory: WEB_PAGE:PORT_NUMBER/apple-app-site-association Everything seems to be set up on this side. I've added the entitlements, updated the provisioning profile, and everything's set up. 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 *
  • How to support Universal Links in iOS App and setup server for it?
    How i can support Universal Links in my iOS application and setup my server in order to support Universal Links?
  • android和ios App打包(使用Hbuilder进行App打包)教程
    一、修改接口地址1.打开uni-app下config/app.js修改接口地址,将下图两个地址修改成您的域名二、配置参数1.打开 uni-app 根目录下的 manifest.json 文件, 点击《基础配置》,重新获取 uni-app应用标识,获取之后填写 应用名称,应用描述,应用版本名称,应用版本号2.点击《App图标配置》,上传APP的图标文件,点击《自动生成所有图标并替换》3.点击《App模块配置》3-1. 选择《Geolocation》,在《高德定位》和《百度定位》中选择一个,填写appkey_ios 和 appkey_android3-2. 选择《LivePusher》3-3. 选择《Maps》,在《高德地图》和《百度地图》中选择一个,填写appkey_ios 和 appkey_android3-4. 选择《OAuth(登录授权)》,选择《微信登录》,填写开放平台的 appid 和 appsecret 以及 Universal Links注:IOS必须同时要选择苹果登录3-5. 选择《Payment(支付)》,选择对应的支付方式,微信支付请填写开放平台的 appid 和 Universal Links3-6. 勾选《Push(消息推送)》3-7. 勾选《Share(分享)》,选择微信分享,填写开放平台的 appid 和 Universal Links3-8. 勾选