3. Initialization
SDK Initialization Steps
Initialization sets up internal SDK components to allow the creation of a Sentiance user on the device, and perform detections in the background.
Only a limited set of SDK methods are allowed to be invoked before initializing the SDK.
1. Initialize in the AppDelegate Class
Initialization must be done in the application:didFinishLaunchingWithOptions:
method of your AppDelegate
class. If you don't already have a custom AppDelegate set up, first create a new class that extends Application
.
2. Import the SDK in your source file.
3. Initialize the SDK
In the application:didFinishLaunchingWithOptions:
method of your AppDelegate
class, call initializeWithOptions:launchOptions:
.
Initialization will normally succeed, unless an unexpected error or exception is encountered. In case of failure, you can check the reason via the returned result.
Incorrect Initialization
You must initialize the SDK during app startup, before application:didFinishLaunchingWithOptions:
returns. Therefore, you must do it synchronously on the main thread. If you plan to add a remote flag to control the initialization (e.g. Firebase Remote Config), make sure the check is synchronous (e.g. utilizing a cached flag).
Last updated