iOS Associated Domains (Universal Links) with Wildcards not working

前端 未结 5 894
情深已故
情深已故 2020-12-24 13:33

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

相关标签:
5条回答
  • 2020-12-24 13:59

    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.

    0 讨论(0)
  • 2020-12-24 14:09

    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.

    0 讨论(0)
  • 2020-12-24 14:20

    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

    0 讨论(0)
  • 2020-12-24 14:20

    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"]
        }
    }
    
    0 讨论(0)
  • 2020-12-24 14:22

    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.

    0 讨论(0)
提交回复
热议问题