Reliable universal links

Platform & distribution Senior Swift 5.0+ iOS 17+ Reviewed By Alok Singh

Pick the fix

A link opens the app but the user must log in first, and the link is lost. Fix?

Options
Hint 1 of 1

Keep the intent until the app is ready.

Choose an answer, then open Show answer below to check it.

Show answer

Answer: A Parse it into a route, store it as pending, finish login, then route to it in the scene that handled the link

Correct. The intent survives the login.

Why not the others?
  • B Show an alert asking the user to tap the link again. It's a poor experience and an easy fix to skip.
  • C Disable universal links for logged-out users. That can't be controlled per user, and it loses traffic.
  • D Open the link in Safari instead. That throws users out of the app.

30-second answer

Serve the apple-app-site-association file at /.well-known/ over HTTPS with no redirects, add the applinks: associated domain, and handle links in every entry point: scene connection options on cold start, scene(_:continue:) when running, or .onOpenURL / .onContinueUserActivity in SwiftUI. Parse the URL into a route, store it if the user must log in first, and deliver it to the right scene after login.

Practise saying it · 45 s. No recording, just a timer

Explain reliable universal links.

Say your answer out loud, then check which of these points you covered:

  • AASA + entitlement
  • Every entry point
  • Pending routes
  • One router

Deep dive

Apple's CDN caches the AASA file; changes can take time.

Use developer mode (?mode=developer) for testing associated domains.

Universal links don't open the app when typed in Safari's address bar or tapped from the same domain.

Keep one router that turns URLs into routes for every source: links, pushes, widgets.

Common mistakes

  • Handling only scene(_:continue:), missing cold start.
  • Dropping the link when login is required.

Senior take & follow-ups

Seniors handle every entry point and pending routes through one router.

Follow-up questions

Think of your answer first, then open the hint.

  1. Why does the link open Safari?

    Show hint

    AASA or entitlement mismatch, CDN caching, or a same-domain tap.

  2. How do you handle a link that needs login?

    Show hint

    Store the pending route and replay it after login.

Suggest a fix if something here is wrong or out of date.