Deeplinking

In order to make sharing fully working you need to setup your app to be able to handle Storyteller deeplinks.

Add associated domain to your project settings in Xcode

At first you need to add associated domain to your projects.

  1. Go to your project settings in Xcode -> Siging & Capabilities

  2. Press +Capability

  3. Choose Associated Domains

  4. Add domain: applinks:[tenant_name].ope.nstori.es

Add bundle identifier to Storyteller CMS

After setting up associated domain you need to add bundle identifier to Storyteller CMS.

  1. Log into Storyteller CMS.

  2. Go to Apps.

  3. Create a new iOS app or edit existing one.

  4. Fill out App ID with your Bundle Identifer from your project settings in Xcode

  5. Press Save

Add handling deeplink to your AppDelegate

As a last step you need to add code handling deeplinking inside your AppDelegate's method:

func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {}

StorytellerSDK provides two methods that can be helpful:

Storyteller.isStorytellerDeeplink(url: URL) -> Bool

This method takes in url and returns true if the url is Storyteller deeplink

 Storyteller.openDeeplink(url: URL, onError: ((Error) -> Void)?) -> Bool

This method opens the story that was specified in the url. As a result it returns true if the url is a Storyteller deeplink.

Example:

func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
    guard userActivity.activityType == NSUserActivityTypeBrowsingWeb, let url = userActivity.webpageURL else { return false }

    if Storyteller.openDeeplink(url: url) {
        return true
    }

    // handle app's deeplinks

After all these steps you should be able to share a story and open the deeplink inside your app.

PREVIOUS
Forward Arrow