Featured image

Universal Links in iOS: Quick Guide Link to heading

Universal Links is an iOS technology that allows you to open your app directly when a user taps a link, instead of opening Safari. If the app is not installed, the link opens normally in the browser.

Quick Implementation Link to heading

1. apple-app-site-association File Link to heading

Create the apple-app-site-association file (without extension) in the /.well-known/ directory of your server:

{
  "applinks": {
    "apps": [],
    "details": [
      {
        "appID": "TEAMID.com.yourdomain.app",
        "paths": ["*"]
      }
    ]
  }
}
Warning
The file must be reachable by Apple’s servers, it’s not enough that your device can reach the file.

2. Verify Reachability Link to heading

Test that Apple can access the file:

https://app-site-association.cdn-apple.com/a/v1/yourdomain.com

3. Xcode Configuration Link to heading

In your Xcode project:

  1. Go to Signing & Capabilities
  2. Add Associated Domains
  3. Enter: applinks:yourdomain.com
Warning
Make sure to configure Associated Domains in the right target (if you’re testing in development, configure them in the development target, not just in release).

4. Team ID Link to heading

You can find the Team ID in:

  • Xcode: Project Settings → Signing & Capabilities → Team
  • Apple Developer Portal: Membership → Team ID
  • Or in your developer account settings

5. App Handling Link to heading

In your AppDelegate or SceneDelegate:

func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
    guard userActivity.activityType == NSUserActivityTypeBrowsingWeb,
          let url = userActivity.webpageURL else {
        return false
    }

    // Handle the deep link
    handleUniversalLink(url)
    return true
}

Final Notes Link to heading

  • The file must be served via HTTPS
  • It can take up to 24 hours for propagation
  • Always test with production builds or TestFlight for accurate results