简体   繁体   English

iOS关联域 - 子域似乎被忽略

[英]iOS Associated Domains - subdomains seems to be ignored

I have two build configurations: App and App Stage . 我有两个构建配置: AppApp Stage

Each configuration has different Associated Domains configured: app.mydomain.com and app-stage.mydomain.com . 每个配置都配置了不同的Associated Domainsapp.mydomain.comapp-stage.mydomain.com

Of course, each website exposes different apple-app-site-association files: app.mydomain.com/apple-app-site-association and app-stage.mydomain.com/apple-app-site-association (HTTP 200, without .json extension, etc.). 当然,每个网站都公开了不同的apple-app-site-association文件: app.mydomain.com/apple-app-site-associationapp-stage.mydomain.com/apple-app-site-association(HTTP 200,没有.json扩展等)。

The problem is that only first registered domain (unfortunately it's Stage) is working properly. 问题是只有第一个注册域(不幸的是它的Stage)才能正常工作。 When I have both apps installed, each deep link ( app.mydomain.com/home and app-stage.mydomain.com/home ) opens the App Stage. 当我安装了这两个应用时,每个深层链接( app.mydomain.com/homeapp-stage.mydomain.com/home )都会打开App Stage。 When I have only App Sage installed, also both links open it. 当我只安装了App Sage时,两个链接都会打开它。 When I have only App installed none link is working. 当我只安装App时,没有链接正常工作。 It looks like the subdomain of Associated Domains is ignored and only mydomain.com is taken into account. 看起来像Associated Domains的子Associated Domains被忽略 ,只考虑mydomain.com

I assume that build configurations are defined correctly because I'm also differentiating other settings like Facebook, Google and others. 我认为构建配置是正确定义的,因为我也区分了其他设置,如Facebook,Google和其他人。

Have you ever encountered a similar problem? 你遇到过类似的问题吗? Is it allowed to use different subdomains of the same domain for the Associated Domains usage? 是否允许对Associated Domains使用相同域的不同子Associated Domains

UPDATE: 更新:

Following @clayjones94 instructions, I checked whether each app downloads a correct JSON file using Charles Proxy. 按照@ clayjones94说明,我检查了每个应用程序是否使用Charles Proxy下载了正确的JSON文件。 I found out that that App Stage is fetching the correct file, while App doesn't fetch any file. 我发现App Stage正在获取正确的文件,而App不会获取任何文件。

I have also edited URL in app-stage.mydomain.com/apple-app-site-association HTTP request in Charles to make sure that app.mydomain.com/apple-app-site-association returns the correct JSON. 我还在Charles的app-stage.mydomain.com/apple-app-site-association HTTP请求中编辑了URL,以确保app.mydomain.com/apple-app-site-association返回正确的JSON。 When I removed -stage from the URL and repeated the call it has fetched a different JSON file, so I confirmed that the backend is working correctly for both configurations. 当我从URL中删除-stage并重复调用时它已经获取了一个不同的JSON文件,因此我确认后端对两种配置都正常工作。

First I thought that my build configurations were incorrect. 首先我认为我的构建配置不正确。 So I decided to replace App's applinks:app.mydomain.com associated domain with Stage's applinks:app-stage.mydomain.com to see if App configuration is able to fetch App Stage file. 所以我决定用Stage的applinks:app-stage.mydomain.com替换App的applinks:app.mydomain.com相关域applinks:app-stage.mydomain.com ,看看App配置是否能够获取App Stage文件。 It worked, the App had downloaded App Stage's JSON file. 它工作正常,App下载了App Stage的JSON文件。 Again, it looks like the subdomain of Associated Domains is ignored and only first registered subdomain is taken into account. 同样, 看起来像Associated Domains的子Associated Domains被忽略 ,只考虑第一个注册的子域。

There is nothing like domain & subdomain concepts when it comes to Universal Links (App Domains).I guess there should be an issue with apple-site-association-file configuration. 当涉及到Universal Links(App Domains)时,没有像域和子域概念那样的东西。我猜应该存在apple-site-association-file配置的问题。

Please check the apple-site-association-configurations regarding the appID field. 请检查有关appID字段的apple-site-association-configurations。 I doubt that you might have placed the same appID in both files. 我怀疑你可能在两个文件中放置了相同的appID。

you should have different appIDs for the two configurations. 您应该为这两种配置使用不同的appID。

When pulling the Apple App Site Association file, your OS should pull both down separately. 在提取Apple App Site Association文件时,您的操作系统应该单独关闭它们。 I recommend deleting both apps and restarting your phone to ensure that no old AASA files are being cached. 我建议删除这两个应用并重新启动手机,以确保没有缓存旧的AASA文件。

When you go to install the apps back onto your phone, you can use Charles Proxy to see whether each installation is pulling the correct AASA file. 当您将应用程序重新安装到手机上时,可以使用Charles Proxy查看每个安装是否正在提取正确的AASA文件。 Since you have both URLs in your associated domains, each installation is going to pull down both AASA files. 由于您的关联域中有两个URL,因此每个安装都将下拉两个AASA文件。 If your production app is not pulling down both it could be an Apple issue and you'll just have to delete the app and try again. 如果您的生产应用程序没有下拉,它可能是Apple问题 ,您只需要删除该应用程序并再试一次。

If you verify that both AASA files are being pulled down for each app, then you should verify that the appIDs are correct (which it seems like you have). 如果您确认每个应用程序的两个AASA文件都被拉下来,那么您应该验证appID是否正确(看起来您有)。 When both apps have both associated domains and both AASA files with the correct appIDs, your OS should open the correct app depending on the link. 当两个应用程序同时具有关联的域和具有正确appID的两个AASA文件时,您的操作系统应根据链接打开正确的应用程序。 If this still doesn't work it could mean that your AASA files have been signed by entitlements associated with your Staging app but not your production app. 如果这仍然无效,则可能意味着您的AASA文件已由与您的暂存应用相关联的权利签署,但不是您的生产应用。

I suggest using Branch for your universal linking. 我建议使用Branch进行通用链接。 Branch has testing links that you can use to test links for your prod app and you should be able create a separate app on Branch for your staging app so you have different links for both. Branch有测试链接,您可以使用它来测试您的prod应用程序的链接,您应该可以在分支上为您的临时应用程序创建一个单独的应用程序,这样您就可以拥有不同的链接。 The nice thing is that we will do all of the AASA handling and signing for you. 好消息是我们将为您完成所有AASA处理和签名。 The deep linking service is free and we perform deferred deep linking :). 深层链接服务是免费的,我们执行延迟深度链接:)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM