Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Associated Domains - subdomains seems to be ignored

I have two build configurations: App and App Stage.

Each configuration has different Associated Domains configured: app.mydomain.com and app-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.).

The problem is that only first registered domain (unfortunately it's Stage) is working properly. When I have both apps installed, each deep link (app.mydomain.com/home and app-stage.mydomain.com/home) opens the App Stage. When I have only App Sage installed, also both links open it. When I have only App installed none link is working. It looks like the subdomain of Associated Domains is ignored and only mydomain.com is taken into account.

I assume that build configurations are defined correctly because I'm also differentiating other settings like Facebook, Google and others.

Have you ever encountered a similar problem? Is it allowed to use different subdomains of the same domain for the Associated Domains usage?

UPDATE:

Following @clayjones94 instructions, I checked whether each app downloads a correct JSON file using Charles Proxy. I found out that that App Stage is fetching the correct file, while App doesn't fetch any file.

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. 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.

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. It worked, the App had downloaded App Stage's JSON file. Again, it looks like the subdomain of Associated Domains is ignored and only first registered subdomain is taken into account.

like image 776
KlimczakM Avatar asked Dec 20 '17 15:12

KlimczakM


2 Answers

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.

Please check the apple-site-association-configurations regarding the appID field. I doubt that you might have placed the same appID in both files.

you should have different appIDs for the two configurations.

like image 113
Kumar Reddy Avatar answered Nov 12 '22 14:11

Kumar Reddy


When pulling the Apple App Site Association file, your OS should pull both down separately. I recommend deleting both apps and restarting your phone to ensure that no old AASA files are being cached.

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. Since you have both URLs in your associated domains, each installation is going to pull down both AASA files. 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.

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). 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. 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.

I suggest using Branch for your universal linking. 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. The nice thing is that we will do all of the AASA handling and signing for you. The deep linking service is free and we perform deferred deep linking :).

like image 24
clayjones94 Avatar answered Nov 12 '22 14:11

clayjones94