iOS Universal Link with a second level subdomain doesn't deep-link to native app, but deep-links fine on a first-level subdomain (same host)

我怕爱的太早我们不能终老 提交于 2019-12-01 04:11:11

问题


I have capabilities in my app that contain multiple applinks: entries like so:

applinks:firstlevel.domain.com
applinks:second.level.domain.com

Universal links on the first level subdomain work fine and open the app. Universal links on the second level subdomain do NOT open the app (go to safari). My suspicion right now is because of the composite (2-piece) subdomain.

The apple-app-site-association files are completely identical on both, and are hosted and downloadable from both. Both URLs are hittable from our internal network and are on the same domain and TLD. SSL is configured correctly. There are no redirects taking place (verified through chrome dev tools)

Each respective apple-app-site-association file is hosted under appropriate subdomain (not on the root of domain.com). But the same top level domain is used for both subdomains in URL 1 and 2.

Can the second-level subdomain be the problem, or is it more likely that other network configuration differences are the problem? I couldn't find information online that states whether multiple subdomains are supported for universal links or not.

UPDATE: Tried removing the applinks:firstlevel.domain.com entry, to make sure the two subdomains aren't conflicting for the same bundle ID (and the site association). This did not make a difference. The second level subdomain still doesn't deep-link.

Any suggestions on how to diagnose why the second URL can not be opened as a deeplink in the app?

It's also not appropriate to use wildcards or upload the apple-app-site-association file to the root of the domain, because that's production, and should not have any lower environment settings on it.

Here's our apple-app-site-association file:

{
    'webcredentials': {
        'apps': ['ourteamid.ca.ourdomain.ourname']
    },
    'applinks': {
        'apps': [],
        'details': [{
            'appID': 'ourteamid.com.ourdomain.ourname1.ourname2',
            'paths': ['r/samplepath/*', 'en/r/samplepath/*', 
'fr/r/samplepath/*']
        }]
    }
}

回答1:


OK, found the solution. It was the single quotes in the apple-app-site-association file (single quotes are not valid JSON). Apple's examples all use double quotes.

At some point, someone converted it to single quotes, and uploaded the file, and we did not catch it. The deeplinks work fine with double quotes in the file, and it had nothing to do with a second level domain.

Updated association file:

    {
    "webcredentials": {
        "apps": ["ourteamid.ca.ourdomain.ourname"]
    },
    "applinks": {
        "apps": [],
        "details": [{
            "appID": "ourteamid.com.ourdomain.ourname1.ourname2",
            "paths": ["r/samplepath/*", "en/r/samplepath/*", "fr/r/samplepath/*"]
        }]
    }
}


来源:https://stackoverflow.com/questions/58665606/ios-universal-link-with-a-second-level-subdomain-doesnt-deep-link-to-native-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!