Allowing Apps and Websites to Link to Your Content

Use universal links to link to content within your app and share data securely.


You can connect to content deep inside your app with universal links. Users open your app in a specified context, allowing them to accomplish their goals efficiently.

When users tap or click a universal link, the system redirects the link directly to your app without routing through Safari or your website. In addition, because universal links are standard HTTP or HTTPS links, one URL works for both your website and your app. If the user has not installed your app, the system opens the URL in Safari, allowing your website to handle it.

When users install your app, the system checks a file stored on your web server to verify that your website allows your app to open URLs on its behalf. Only you have the ability to store this file on your server, securing the association of your website and your app.

Support Universal Links

Take the following steps to support universal links:

  1. Create a two-way association between your app and your website and specify the URLs that your app handles, as described in Enabling Universal Links.

  2. Update your app delegate to respond to the user activity object the system provides when a universal link routes to your app, as described in Handling Universal Links.

With universal links, users open your app when they tap links to your website within Safari and WKWebView, and links that result in a call to open(_:options:completionHandler:) in iOS and tvOS or a call to open(_:withApplicationAt:configuration:completionHandler:) in macOS, such as those that occur in Mail, Messages, and other apps.

When a user browses your website in Safari and taps a universal link in the same domain, the system opens that link in Safari, respecting the user’s most likely intent to continue within the browser. If the user taps a universal link in a different domain, the system opens the link in your app.

Communicate with Other Apps

Apps can communicate through universal links. Supporting universal links allows other apps to send small amounts of data directly to your app without using a third-party server. 

Define the parameters that your app handles within the URL query string. For example, a photo library app might specify parameters that include the name of an album and the index of a photo to display.

Listing 1

Examples of URLs with album name and photo index parameters

Other apps craft URLs based on your domain, path, and parameters, and ask your app to open them by calling the open(_:options:completionHandler:) method of UIApplication in iOS and tvOS, or the open(_:withApplicationAt:configuration:completionHandler:) method of NSWorkspace in macOS. The calling app can ask the system to inform them when your app opens the URL.

Listing 2

An example of an app calling your universal link in iOS and tvOS

if let appURL = URL(string: "") { { success in
        if success {
            print("The URL was delivered successfully.")
        } else {
            print("The URL failed to open.")
} else {
    print("Invalid URL specified.")

Listing 3

An example of an app calling your universal link in macOS

if let appURL = URL(string: "") {
    let configuration = NSWorkspace.OpenConfiguration(), configuration: configuration) { (app, error) in
        guard error == nil else {
            print("The URL failed to open.")
        print("The URL was delivered successfully.")
} else {
    print("Invalid URL specified.")

For more information on handling links within your app, see Handling Universal Links.


Universal Links

Enabling Universal Links

Configure your app and website to support universal links.

Handling Universal Links

Prepare your app to respond to an incoming universal link.

Custom URLs

Defining a Custom URL Scheme for Your App

Use specially formatted URLs to link to content within your app.

Associated Domains

Supporting Associated Domains in Your App

Connect your app and a website in order to provide both a native app and a browser experience.