iOS SDK Initialization 4.x.x

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 MOFlutterInitializer instance in applicationdidFinishLaunchingWithOptions() method as shown below:



Make sure to set the correct Data Center while initializing the SDK. For more info refer to the following link.

Swift Objective-C
// Import SDK frameworks
import moengage_flutter
import MoEngage
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    // Call SDK Initialize method
    // Update your SDK Config here.
    var sdkConfig : MOSDKConfig
    let yourAppID = "Your MoEngage App ID" //App ID: You can be obtain it from App Settings in MoEngage Dashboard.
    if let config = MoEngage.sharedInstance().getDefaultSDKConfiguration() 		{
        sdkConfig = config
        sdkConfig.moeAppID = yourAppID
        sdkConfig = MOSDKConfig.init(appID: yourAppID)
    // Set Correct Data Center here
    sdkConfig.moeDataCenter = DATA_CENTER_01 //DATA_CENTER_01,DATA_CENTER_02,DATA_CENTER_03
    // Set App Group ID for sharing data between App and extensions(if Any)
    sdkConfig.appGroupID = "app group id"

    // Change these if required, by default all the below opt-outs are set to false. 
    sdkConfig.optOutIDFATracking = false
    sdkConfig.optOutIDFVTracking = false
    sdkConfig.optOutDataTracking = false
    sdkConfig.optOutPushNotification = false
    sdkConfig.optOutInAppCampaign = false
   MOFlutterInitializer.sharedInstance.initializeWithSDKConfig(sdkConfig, andLaunchOptions: launchOptions)
    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)



Was this article helpful?
0 out of 0 found this helpful

How can we improve this article?