š§Ŗ How to test Universal Links
If you already know what Universal Links are (if not, I recommend reading this article first), the next step is getting them to work in test environments. And it can be a real headache.
If youāve tried configuring Universal Links and they donāt work in pre-production, preview, or similar, itās probably due to one of these points:
- Incorrect location of the
apple-app-site-associationfile - Incorrect configuration of Associated Domains in Xcode
- Not using developer mode for testing
- Trying to test them from Safari (Appleās special behavior)
- Having Chrome or another browser as default (iOS 14+)
š 1. Incorrect location of the apple-app-site-association file
The problem with placing the file at the root of our project is that in test environments, usually private or behind a VPN, Apple doesnāt have access to that specific file path, so it wonāt work.
Why does this happen?
In production, Apple saves the file to its own CDN and accesses it as the first option. But in private test environments or behind a VPN, Appleās servers canāt access your domain, so they canāt download and save it to their CDN.
Keep in mind that Apple caches this information in its CDN when you install the app. If you change something, you need to delete and reinstall it, otherwise it will use the cached version it already has.
Solution: Place the file inside .well-known/
# Correct ā
.well-known/apple-app-site-association
# Incorrect ā
.well-known/apple-app-site-association.json
.well-known/apple-app-site-association.txt
ā ļø Critical: The file should NOT have a .json extension - it must be called exactly apple-app-site-association
Using .well-known ensures it will work equally in production and preview/pre-production.
š” Tip: If you canāt change the file path right now, or need to wait for it to take effect, you can use Charles Proxy or Proxyman to intercept the call and serve your own file. You can see more details in this Stack Overflow discussion. Though I have to say, I couldnāt get it to work, but proxies and I donāt get along very well. š
āļø 2. Incorrect Associated Domains configuration in Xcode
In Xcode, you need to correctly configure Associated Domains in your appās capabilities.
Steps to follow:
- Open your project in Xcode
- Select your target ā Signing & Capabilities
- Click + Capability and add Associated Domains
- Add your domain with the format:
applinks:your-domain.comwith developer mode at the end?mode=developer
applinks.my-app.com?mode=developer
ā ļø Important:
- DONāT include
https://orhttp:// - DONāT include the trailing
/
š§ 3. Not using developer mode for testing
- Connect your iOS device to your Mac
- Open Xcode and go to Window ā Devices and Simulators
- Select your device
- On your iOS device, go to Settings ā General ā VPN & Device Management
- Tap your developer profile and trust it
- Go to Settings ā Developer (only appears after connecting to Xcode)
- Enable Associated Domains Development
ā ļø Critical: Without this mode enabled, iOS wonāt verify Universal Links in development environments, even if everything is configured correctly.
šØ 4. Trying to test them from Safari
This is one of the most common mistakes. Safari has special behavior with Universal Links that can make them not work as expected.
Why does this happen?
Safari has its own logic for handling Universal Links. When you click a link inside Safari, it might open the web page instead of the app, even if the app is installed and correctly configured.
Solution: Use other apps to test Universal Links, like Notes, for example.
š 5. Having Chrome or another browser as default (iOS 14+)
Since iOS 14, Apple changed the behavior of Universal Links when you have a browser other than Safari as default.
What happens?
If you have Chrome, Firefox, or another browser as default, iOS may not open the app when you click a Universal Link, even if itās correctly configured. As far as I know, thereās no solution other than using Safari as the default browser.
Final reflection
Universal Links in test environments require specific configuration that differs from production. Key points to remember:
Key points:
- Forget the simulator, it only works on real iOS devices.
- The file must be in
.well-known/- not at the domain root - Developer options only appear after connecting the device to Xcode
- You must enable āAssociated Domains Developmentā in device settings
- Only works in development with development certificates + developer mode
- DONāT use Safari for testing - use Messages, Notes, Mail, etc.
- Safari must be the default browser
- Configuration is cached - reinstall the app after changes
Have you had problems configuring Universal Links in test environments? Iād love to hear about your experience!
See you around š«¶
Useful resources
- š¹ Official Apple video: Whatās New in Universal Links (WWDC 2020) - Complete session where Apple explains Universal Links
- š Well-Known.dev: Tool to search and verify
.well-known/files on websites, includingapple-app-site-association. Lets you see the associated domains of any page and verify your configuration is correct - š Official documentation: Supporting Universal Links - Complete Apple documentation