Handling Universal Links
Prepare your app to respond to an incoming universal link.
When a universal link is activated, iOS launches your app and sends it an
NSUserActivity object. Query this object to find out how your app was launched and to decide what action to take.
To support universal links in your app, take the following steps:
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 when it receives an
NSUserActivity object with the
activityType set to
Update Your App Delegate to Respond
When iOS opens your app as the result of a universal link, your app receives an
NSUserActivity object with an
activityType value of
NSUserActivityTypeBrowsingWeb. The activity object’s
webpageURL property contains the HTTP or HTTPS URL that the user accesses. Use
NSURLComponents APIs to extract the components of the URL. For an example, see Listing 1.