iOS SDK - Adding Deep Linking Support

Adding Deep Linking Support

When a user clicks a deep link on a device that has the app installed, the app opens and shows a specific product or experience.

Singular tracking links can include deep linking functionality as well as deferred deep linking (see our Deep Linking FAQ and the Singular Links FAQ for more information).

The Singular SDK Config, implemented in the previous step, references a callback function ("handleDeeplink"). The "handleDeeplink" function is required to enable deep link and deferred deep link support through the Singular SDK.

Prerequisites for Implementing Deep Links

Make sure you have completed the following steps:

  • Followed the instructions in Singular Links Prerequisites.
  • In Xcode, added a Singular Custom Subdomain to Signing & Capabilities > Associated Domains.
  • Added the app scheme to your URL Types at Info > URL Types.
  • Added your Apple Developer Team ID and Scheme in the Apps page in the Singular platform.

Notes:

  • If the app is already configured to use iOS Universal Links, the Universal Link domain already exists in Associated Domains and can remain. This domain should be added to the Supported Domains config option, as noted in the next section.
  • You must also include the Singular custom link domain, so that Singular can track attributions from marketing campaigns and handle deep links from these campaigns.

Creating the Callback Method for the Handler

The code example below creates a callback method called handleDeeplink (this method is referenced in the Config code sample above).

The block signature is void(^)(SingularLinkParams*). The SingularLinkParams contains the deep link destination, passthrough parameters, and whether the link is deferred or not.

SwiftObjective-C
func handleDeeplink(params: SingularLinkParams?) {
     
     // Get Deeplink data from Singular Link

     let deeplink = params?.getDeepLink()
     let passthrough = params?.getPassthrough()
     let isDeferredDeeplink = params?.isDeferred()
     let urlParams = params?.getUrlParameters()
     
     // Add deep link handling code here

     //...
}

Other Link Options