In order to make sharing work, you need to setup your app to be able to handle Storyteller deeplinks.
At first you need to add associated domain to your projects.
Go to your project settings in Xcode -> Signing & Capabilities
Press +Capability
Choose Associated Domains
Add domain: applinks:[tenant_name].ope.nstori.es
After setting up an associated domain you need to add a bundle identifier to Storyteller CMS.
Log into Storyteller CMS
Go to Apps
Create a new iOS app or edit existing one
Fill out App ID
with your Bundle Identifier
from your project settings in Xcode
Press Save
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 a URL and returns true
if the URL is a 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 completing these steps you should be able to share a Story and open the deeplink inside your app.