how to add support for "?" (query) in path for apple-app-site-association file?

335 views Asked by At

"apple-app-site-association" file content:

{

    "appclips": {
        "apps": ["**********.com.project.example.Clip"]
    },
    "applinks": {
        "apps": ["**********.com.project.example"],
        "details": [
          {
            "appID": "**********.com.project.example",
            "paths": [ "/event/*", "/ticket?v=*" ]
          }
        ]
    }
}

File is already set at "https://< fully qualified domain>/.well-known/apple-app-site-association"

problem I'm facing is that it is working for

"https://< fully qualified domain>/event/EVENT-ID",

but it is not invoking app for

"https://< fully qualified domain>/ticket?v=VOLUME-ID"

Is it because of "?" or I'm missing some thing?

2

There are 2 answers

2
tank On BEST ANSWER

We need to use components array

 "components": [  
     {
         "/": "/help/*",
         "?": { "articleNumber": "????" },
         "comment": "blah blah"
     }
 ]

Please refer https://developer.apple.com/documentation/xcode/supporting-associated-domains

1
Deep Gandhi On

ended up implementing this solution:

used "components" instead "paths"

{
  "appclips": {
    "apps": [
      "**********.com.project.example.Clip"
    ]
  },
  "applinks": {
    "apps": [
      "**********.com.project.example"
    ],
    "details": [
      {
        "appID": "**********.com.project.example",
        "components": [
          {
            "/": "/event/*",
            "comment": "(www.example.com/event/EVENTID) Matches any URL with a path that starts with /event/."
          },
          {
            "/": "/ticket",
            "?": {
              "v": "???????"
            },
            "comment": "(www.example.com/ticket?v=QWERTYU) Matches any URL with a path that has a query item with name 'v' and a value of exactly seven characters."
          },
          {
            "?": {
              "L": "??????????"
            },
            "comment": "(www.example.com?L=QWERTYUIOP) Matches any URL with a path that has a query item with a value of exactly ten characters."
          }
        ]
      }
    ]
  }
}

Note:

  1. when checking deepLinking, wait for a while as it takes time to reflect change after updating AASA file content. apple document resource
  2. iOS will download your AASA when your app is first installed and when updates are installed from the App Store, but it will not refresh any more frequently. If you wish to change the paths in your AASA for a production app, you will need to issue a full update via the App Store so that all of your users' apps re-fetch your AASA and recognize the new paths. refrence