Bug: Correct ASSA File not fetched

How does iOS handle Associated Domains and AASA files when switching between environments? I have an iOS application that supports multiple environments (test and production). Each environment has its own domain and its own AASA file. We have an SDK that requires a domain during initialization. Based on the selected environment, we initialize the SDK with either the test domain or the production domain. We have configured the Associated Domains capability in Xcode with the required domains. However, i'm unclear about how iOS manages the AASA association in this scenario. For example: test.example.com Has its own AASA file. Used when the SDK is initialized with the test domain. example.com Has its own AASA file. Used when the SDK is initialized with the production domain. The SDK receives the domain during initialization, and we dynamically select the domain based on the environment configuration. The question is: If multiple domains are configured in Associated Domains, does iOS fetch and cache the AASA file for all configured domains when the app is installed, or only for the domain currently being used by the application? If the application switches the SDK configuration from the test domain to the production domain (or vice versa) after installation, how does iOS know that it needs to fetch the AASA file for the new domain? Is there any supported way to force iOS to re-fetch the AASA file for a newly selected associated domain? Trying to understand the correct approach for supporting multiple environments when the SDK domain is selected dynamically at runtime. If both test and production domains are configured in Associated Domains, how does iOS determine which AASA file should be used when the SDK is initialized with a specific domain (for example, test)? Does iOS fetch and validate both AASA files upfront and then check only the matching domain at runtime, or does it dynamically fetch/check only the domain provided to the SDK?

Thanks for the post. Thanks for your patience.

iOS fetches the AASA files for ALL domains listed in your app's Associated Domains entitlement immediately upon app installation or update. When a user downloads your app from the App Store (or when you install it via Xcode/TestFlight), a background system called reads the Associated Domains entitlement. It then reaches out to Content Delivery Network to download the AASA files for every single domain listed. It does not know or care which environment your SDK is currently configured to use. If both applinks:test.example.com and applinks:example.com are in your entitlement, iOS will fetch and cache both AASA files during installation.

About how does iOS know to fetch the new domain? It doesn't need to fetch anything because it already fetched both AASA files when the app was installed. There is no programmatic way to force iOS to re-fetch an AASA file from within your app's code.

However, during development and testing, you can bypass the CDN and force a direct fetch using the developer mode query parameter in your entitlement.

In Xcode, change your Associated Domains to:

  • applinks:test.example.com?mode=developer
  • applinks:example.com?mode=developer

When ?mode=developer is appended, iOS will bypass CDN and fetch directly from your server. To trigger the re-fetch, you must delete the app and reinstall it, or increment the build number and install over the existing app. But an install needs to happen. The developer mode parameter only works if the device is in Developer Mode or if the app is signed with a development profile. It will be ignored in App Store/production builds. So please do not submit that into production.

Put both domains in your Associated Domains entitlement. Host valid AASA files on both servers. Let iOS fetch both at install time. Then, write logic in your app delegate or scene delegate to inspect incoming URLs and ensure they are processed by the correct SDK environment.

Albert  WWDR

Bug: Correct ASSA File not fetched
 
 
Q