How to test Universal Links in the iOS Simulator (xcrun simctl openurl)
The commands and settings for testing Universal Links in the iOS Simulator: simctl openurl, a cold start test, developer mode for a local or staging server, the built-in diagnostics screen, where to tap a link when the simulator has no Notes app, and what to do when Safari opens instead.
To test a Universal Link in the iOS Simulator, install your app on a booted simulator and run xcrun simctl openurl booted "https://links.example.com/product/42". If the app's Associated Domains entitlement and the domain's apple-app-site-association file agree, the app opens on that screen. If Safari opens, the simulator hasn't linked the app to the domain yet, and the diagnostics screen in the simulator's Settings app tells you whether the URL is recognised.
The simulator is a quick first check, not the last one. Developers report on Apple's forums that Universal Links are less dependable there than on a phone, so confirm on a real device before you ship. This post covers the simulator only; the wider set of tests is in how to test deep links on Android and iOS.
The command
# Open a link on the booted simulator
xcrun simctl openurl booted "https://links.example.com/product/42"
# More than one simulator running? Name the device
xcrun simctl list devices booted
xcrun simctl openurl 3F2A9C1E-0000-0000-0000-000000000000 "https://links.example.com/product/42"
simctl describes the subcommand in one line: "Open a URL in a device." It hands the URL to the simulator's system, which decides what to do with it, the same decision iOS makes for a tapped link. Quote the URL, because ? and & mean something to the shell.
The same command opens a custom scheme (myapp://product/42). That's a different test: a scheme needs no domain and no file, so it passing says nothing about your Universal Links.
Before you run it
Three things must be true, the same as on a phone:
- The app is installed on that simulator and was built with the Associated Domains capability, with an entry such as
applinks:links.example.com. Check the capability under the build configuration you run (usually Debug). - The domain serves the file at
https://links.example.com/.well-known/apple-app-site-associationwith HTTP 200, a valid certificate and no redirect. The AASA validator checks this from outside your network. - The app ID in the file matches the build. It's
<Team ID>.<bundle identifier>. A Debug build with a different bundle identifier (com.example.app.dev) needs its own entry in the file.
The link between app and domain is made when the app is installed. If you fix the file afterwards, delete the app from the simulator and install it again.
Test a cold start and a warm start
A link that works while the app is open can still fail when the app has to launch first. Test both:
# Cold start: stop the app, then open the link
xcrun simctl terminate booted com.example.app
xcrun simctl openurl booted "https://links.example.com/product/42"
# Warm start: the app is in the background
xcrun simctl openurl booted "https://links.example.com/order/9"
In a UIKit app with scenes, a cold start delivers the link in scene(_:willConnectTo:options:) through connectionOptions.userActivities, and a warm start delivers it in scene(_:continue:). Apps that only implement one of the two pass one test and fail the other. In SwiftUI, .onOpenURL receives both.
Use the diagnostics screen first when it fails
The simulator's Settings app has a Developer section with a Universal Links group. It holds two things:
- Associated Domains Development, a switch that developer mode needs (next section).
- Diagnostics, a screen where you type a full URL and the system says whether it's a Universal Link for an installed app.
This is the same tool Apple's technote TN3155 describes for devices, and it answers the main question without guessing: does the system know this URL belongs to your app? If Diagnostics says the URL isn't recognised, the problem is the association (file, entitlement, app ID or install order). If it is recognised and the app still shows the wrong screen, the problem is in your link handling code.
Test against a local or staging server with developer mode
Normally Apple's CDN fetches the association file on behalf of devices, and Apple's documentation says the CDN requests a new file within 24 hours. That's too slow when you're editing the file, and the CDN can't reach a server on your laptop at all. Developer mode makes the system fetch the file straight from your server.
- Add the mode to the entitlement:
applinks:staging.example.com?mode=developer
- In the simulator, open Settings > Developer and turn on Associated Domains Development.
- Delete the app from the simulator, then build and run again.
Apple's entitlement documentation says that in this mode "you can use any valid SSL certificate" on the server, "including a certificate that the system doesn't trust", and that it only works for apps signed with a development profile. Two limits remain:
- It still has to be HTTPS. A plain
http://localhostserver can't serve the file. - No port numbers. TN3155 says "Domains in your applinks can't contain a port number", so
applinks:localhost:3000is invalid.
The practical route for a local server is an HTTPS tunnel that gives you a host name on port 443, and that host name in the entitlement with ?mode=developer. Remove the mode before a release build.
Test a real tap, not only the command
simctl openurl shows that the system routes the URL to your app. It doesn't show what happens when a person taps the link in another app, and it can't be compared with typing the URL in Safari: TN3155 says "Entering the URL directly into the web browser's address bar will never open the app."
Apple's advice for devices is to paste the link into Notes and tap it. A recent simulator may not have Notes or Mail: the iOS 27 simulator we checked lists Safari, Messages, Calendar, Reminders and Settings. These work instead:
- Reminders or Calendar. Add the link to a reminder or an event and tap it there.
- Safari, from another domain. Open any page on a different domain that contains the link and tap it. A link to the domain you're already on stays in Safari by design, so the page must be on another host.
Long-press the link to see the choice between the app and the browser. The choice sticks for that domain, so if you ever pick the browser, long-press again and choose the app to switch it back.
When Safari opens instead of your app
Work down this list. Each step rules out one cause.
| Check | How |
|---|---|
| The file is reachable and valid | Run the domain through the validator |
| The app ID in the file matches this build | Compare the team ID and bundle identifier of the Debug build |
| The app was installed after the file was correct | Delete the app, then install again |
| The system recognises the URL | Settings > Developer > Universal Links > Diagnostics |
| Apple's CDN is behind | Use ?mode=developer with Associated Domains Development on |
| The simulator's own state is stale | Erase it and try a fresh one |
To delete the app or reset the simulator from the terminal:
xcrun simctl uninstall booted com.example.app
# Erase a simulator (shut it down first)
xcrun simctl shutdown booted
xcrun simctl erase 3F2A9C1E-0000-0000-0000-000000000000
To watch the association service while the app installs, stream its log:
xcrun simctl spawn booted log stream --level debug --predicate 'process == "swcd"'
swcd is the daemon that downloads and checks association files. Errors about the download, the JSON or the app ID show up here.
If every check passes and the simulator still opens Safari, test on a phone before you spend more time. In a January 2026 thread on Apple's developer forums about Universal Links failing in Xcode 26.1 simulators while working on devices, an Apple engineer replied that the simulator "frequently malfunctions and requires a complete reload", and suggested updating Xcode, clearing simulator data and using a physical device. An older thread from 2023 describes simctl openurl opening Safari for links that worked on a phone, with no answer from Apple.
What the simulator can't tell you
- Install from the App Store or TestFlight. There's no store on the simulator, so you can't test what a new user sees.
- Links inside other apps. Instagram, WhatsApp, Gmail and Chrome aren't there. Their in-app browsers and link rewriting are where many real failures happen. The deep link tester shows how a link opens from each of them.
- Release signing. Developer mode and a Debug bundle identifier differ from what users install. Check a TestFlight build on a phone.
- Smart App Banners. Apple's documentation says banners don't appear in the simulator.
A sensible order: simulator while you build, a phone with a development build when the routing works, then TestFlight before release.
FAQ
Do Universal Links work in the iOS Simulator?
Yes, when the app is installed with the Associated Domains entitlement and the domain's apple-app-site-association file lists the build's app ID. They are less reliable than on a device, so treat a failure in the simulator as a reason to check on a phone, not as proof of a bug.
Why does xcrun simctl openurl open Safari instead of my app?
The simulator hasn't associated the app with the domain. The usual causes are a file that Apple's CDN hasn't fetched yet, an app ID that doesn't match the Debug build, or an app installed before the file was fixed. Reinstall the app and check the URL in Settings > Developer > Universal Links > Diagnostics.
Can I test Universal Links with localhost?
Not directly. The association file must be served over HTTPS and the entitlement can't contain a port number. Use an HTTPS tunnel to your local server and add ?mode=developer to the entitlement.
Does simctl openurl work for custom URL schemes?
Yes. xcrun simctl openurl booted "myapp://product/42" opens the app that registered the scheme. It doesn't test Universal Links, which depend on the domain and the association file.
Where is the Notes app in the simulator?
Some simulator runtimes don't include it. Put the link in Reminders or Calendar, or tap it on a web page from another domain in Safari.
Fewer moving parts with CodeOnAir
Most simulator failures come from the association file and the entitlement disagreeing. CodeOnAir AppLinks hosts the file for your link domain from the team ID and bundle identifier you enter, and the iOS SDK hands every link to one callback:
DeepLink.initialize()
DeepLink.onLink { link in
// link.path, link.params
}
Universal Links reach it through DeepLink.handle(userActivity), on a cold start and a warm one. The steps are in the iOS SDK docs, and you can create a free account to try it: the Free plan includes 100 app links.
Checked on 16 November 2026 against Apple's technote TN3155, the Associated Domains entitlement and Smart App Banner documentation, Apple Developer Forums threads 812475 and 739379, and the simulator runtimes shipped with Xcode 27.0.