The SDK needs to be initialized with some basic settings (such as the directory the SDK can use for data storage and logs), and with a TokenSigner that is provided by the host application. This must occur early in the lifecycle of the app.

import Common

 // Choose a directory that the SDK can access and will own.
let sdkDirectory = FileManager.default.urls(for: .documentDirectory, in:.userDomainMask).first!.appendingPathComponent("sdk", isDirectory: true)

// The AppTokenSigner is a stub for the TokenSigner implementation developed within the host application.
try! initialize(Directories(root: sdkDirectory), tokenSignerFactory: { AppTokenSigner() })

How to implement Token Signer see here.

WARNING: Failing to initialize the SDK before using its functionality will result in unexpected behaviour.

Last updated