具有第二级子域的iOS Universal Link不会深度链接至本机应用程序,但在第一级子域(相同主机)上的深层链接很好 [英] 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)

查看:161
本文介绍了具有第二级子域的iOS Universal Link不会深度链接至本机应用程序,但在第一级子域(相同主机)上的深层链接很好的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序中具有包含多个应用程序链接的功能:类似这样的条目:

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

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

一级子域上的通用链接可以正常工作并打开应用程序. 二级子域上的通用链接不会打开该应用程序(进入野生动物园).我现在的怀疑是由于复合(2个部分)子域.

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.

apple-app-site-association文件在两者上都是完全相同,并且可以从两者托管和下载. 这两个URL均可从我们的内部网络访问,并且位于相同的域和TLD上. SSL已正确配置.没有重定向发生(通过chrome开发工具进行了验证)

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)

每个 apple-app-site-association 文件分别托管在适当的子域下(而不是domain.com的根目录下).但是相同的顶级域用于URL 1和2中的两个子域.

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.

更新:尝试删除applinks:firstlevel.domain.com条目,以确保两个子域不会因相同的捆绑软件ID(和站点关联)而发生冲突.这并没有改变.二级子域仍未进行深层链接.

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.

关于如何诊断为什么第二个URL无法在应用程序中作为深层链接打开的任何建议?

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

也不适合使用通配符或将apple-app-site-association文件上传到域的根目录,因为这是生产环境,并且不应在其上设置任何较低的环境设置.

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.

这是我们的apple-app-site-association文件:

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/*']
        }]
    }
}

推荐答案

确定,找到了解决方案.它是apple-app-site-association文件中的单引号(单引号不是有效的JSON).苹果公司的示例都使用双引号.

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.

更新的关联文件:

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

这篇关于具有第二级子域的iOS Universal Link不会深度链接至本机应用程序,但在第一级子域(相同主机)上的深层链接很好的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆