iOS SDK Initialization

To initialize the iOS Application with the MoEngage App ID from Settings in the dashboard. In your project, go to AppDelegate file and  call the initialize method of MoECapacitorInitializer instance in applicationdidFinishLaunchingWithOptions() method as shown below:

Sample code to initialize from application:didFinishLaunchingWithOptions: method in

swift

import UIKit
import Capacitor
import CapacitorMoengageCore
import MoEngageSDK

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        let sdkConfig = MoEngageSDKConfig(withAppID: YOUR APP ID)
        sdkConfig.moeDataCenter = .data_center_01
        MoECapacitorInitializer.sharedInstance.initializeDefaultInstance(sdkConfig, andLaunchOptions: launchOptions)
        return true
    }
 }
        
Was this article helpful?
0 out of 0 found this helpful