After installation, you will need to integrate CleverTap SDK into your app.
- Follow the integration instructions starting with Step 2 here.
- Initialize CleverTap SDK by adding the following code snippet:
- Import the CleverTap header in your AppDelegate file
#import "CleverTap.h"
#import "CleverTapPlugin.h"import CleverTapSDK
import clevertap_plugin- In your
didFinishLaunchingWithOptions:method notify the CleverTap Flutter SDK of application launch
[CleverTap autoIntegrate]; // integrate CleverTap SDK using the autoIntegrate option
[[CleverTapPlugin sharedInstance] applicationDidLaunchWithOptions:launchOptions];CleverTap.autoIntegrate() // integrate CleverTap SDK using the autoIntegrate option
CleverTapPlugin.sharedInstance()?.applicationDidLaunch(options: launchOptions)If your app uses the UIScene lifecycle (a SceneDelegate with a UIApplicationSceneManifest in Info.plist), the cold-launch push payload is delivered to scene(_:willConnectTo:options:) rather than didFinishLaunchingWithOptions:. In that case launchOptions is nil, so you must ALSO notify the plugin from your SceneDelegate for getInitialUrl to return the deep link on a cold launch.
- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
[[CleverTapPlugin sharedInstance] sceneWillConnectWithOptions:connectionOptions];
}func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
CleverTapPlugin.sharedInstance()?.sceneWillConnect(withOptions: connectionOptions)
}Apps that do NOT use the
UIScenelifecycle need no changes - keep callingapplicationDidLaunchWithOptions:fromdidFinishLaunchingWithOptions:as shown above.
-
Call the following from your Dart.
CleverTapPlugin.registerForPush();