Posted in

Universal Links vs Deep Links in iOS

Spread the love
Reading Time: 2 minutes

Deep linking is a powerful way to connect users directly to specific content inside your app. But not all links are created equal — in iOS, lets have a look at Deep Links Vs Universal Links, each with its own advantages.

1. What is a Deep Link?

A Deep Link is a custom URL scheme your app handles.

Example:

myapp://profile/123

When the user taps this link, iOS checks if your app supports myapp://.

  • ✅ If yes → The app opens directly.
  • ❌ If no → The user sees an error (Safari can’t open the page).

Note: Deep Links are app-only. They don’t fall back gracefully to a website if the app isn’t installed.

2. What is a Universal Link?

A Universal Link uses a real HTTPS URL that works in both your website and your app.

Example:

https://example.com/profile/123
  • Opened in Safari or a browser → Loads the webpage.
  • Opened on a device with your app installed → Opens the app directly.

You configure this by hosting an apple-app-site-association (AASA) file on your domain and telling iOS which paths your app can open.

Universal Links provide the best user experience:

  • If app is installed → Opens the app.
  • If not installed → Opens the website.

3. Key Differences

FeatureDeep Link (Custom URL Scheme)Universal Link
Formatmyapp://product/123https://example.com/product/123
Works without app?❌ No, fails if app not installed✅ Yes, opens website
Security❌ Anyone can claim a scheme✅ Verified with AASA + HTTPS
Best forInternal testing, private appsPublic apps, real-world usage

4. Setup Process

A. Deep Link Setup

  1. Define a URL scheme in your Info.plist file under CFBundleURLTypes.
  2. Handle the link in your AppDelegate:
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
    print("Opened via deep link: \(url)")
    return true
}

B. Universal Link Setup

  1. Create the AASA file and host it on your server at:
https://example.com/apple-app-site-association

Example file:

{
  "applinks": {
    "apps": [],
    "details": [
      {
        "appID": "ABCDE12345.com.yourcompany.myapp",
        "paths": [ "/profile/*", "/product/*" ]
      }
    ]
  }
}
  1. Enable Associated Domains in your app’s capabilities:
    Add: applinks:example.com
  2. Handle the link in SceneDelegate (iOS 13+):
func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
    if userActivity.activityType == NSUserActivityTypeBrowsingWeb,
       let url = userActivity.webpageURL {
        print("Opened via universal link: \(url)")
    }
}

In Short

  • Use Deep Links if you only need internal routing inside your app.
  • Use Universal Links for a seamless, secure experience between your app and website — Apple’s recommended method.

I'm a passionate iOS Developer with over 8 years of experience building high-quality iOS apps using Objective-C, Swift, and SwiftUI. I created iostutor.com to share practical tips, tutorials, and insights for developers of all levels.

When I’m not coding, I enjoy exploring new technologies and writing content — from technical guides to stories and poems — with the hope that it might help or inspire someone, somewhere.

One thought on “Universal Links vs Deep Links in iOS

Leave a Reply

Your email address will not be published. Required fields are marked *