Use universal links to link to content within your app and share data securely.
Universal links let you connect to content deep inside your app. Users open your app in a specified context, allowing them to accomplish their goals efficiently.
Universal links provide several key benefits. First, iOS redirects universal links directly to your app without routing through Safari or your website. In addition, one URL works for both your website and your app, and you can use standard URL processing for routing and payload extraction.
When users install your app, iOS 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:
Create a two-way association between your app and your website and specify the URLs that your app handles. See Enabling Universal Links.
Update your app delegate to respond to the user activity object iOS provides when a universal link routes to your app. See Handling Universal Links.
Universal links allow users to open your app when they tap links to your website within Safari pages, within
UIWeb views, and links that result in a call to
open(_:, 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, iOS 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, iOS opens the link in your app.
Communicate with Other Apps
UIKit 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 includes the name of an album and the index of a photo to display. Examples of URLs could include the following:
Other apps craft URLs based on your domain, path, and parameters, and ask your app to open them by calling the
open(_: method of
UIApplication. The calling app can ask the system to inform them when your app opens the URL. For an example, see Listing 2.
For more information on handling links within your app, see Handling Universal Links.