How to create a Universal Link with page fragments and a query component

I am trying to create and new iOS 13 Associated Domain native link that has a page fragment AND a query component.


My link has these parts HTTPS://domain.com/#/fragment?property=value_***


I've tried a lot of iterations of this:


{

"applinks": {

"details": [{

"appIDs": ["MXXXXX.com.my.mobileapp"],

"components": [

{

"#": "/fragment"

},

{

"/": "/*",

"?": {

"property": "????" < and I've tried * and I've tried taking it out, and I've tried mixing it in with the

}

}]

}]

},

"webcredentials": {

"apps": ["MXXXXX.com.my.mobileapp"]

}

}


I can get it to work with any path, and I can get it to work with any fragment, BUT when I add a property of ANY kind, it doesn't register. What format would work with a property that is variable?

Replies

I was having trouble with getting properties to work, and I think it's come down to device testing being unreliable. I was finally able to get consistent results by using the simulator "Erase all content and settings" and starting from scratch each time I changed apple-app-site-association. Btw to test on the simulator, just have it running and run something like:

xcrun simctl openurl booted "https://example.com/foo?bar=EdJn"


Note that the ???? property means a value of exactly four characters. If you want a property of any value, you can do this as one of the "details":

{
  "appIDs": ["ABC123.com.company.name"],
  "components": [{
                  "/": "/foo",
                  "?": "prop=?*"
              }]
}


I got this from this WWDC video https://developer.apple.com/videos/play/wwdc2019/717/ at the 6:10 mark.


I haven't yet tested this on device, but at least I'm getting consistent results on simulator. My theory is that the cache is just "stickier" on device, and you probably have to go thru some restart/delete/wait incantation to get that working. I'll update here if I find that it *only* works on simulator (which would obviously be bad news).


PS: I did not try fragments at all.