> ## Documentation Index
> Fetch the complete documentation index at: https://moengage-sdk-docs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# iOS SDK Initialization

# Initialization

To initialize the iOS Application with the MoEngage Workspace ID from Settings in the dashboard. In your project, go to the ***AppDelegate*** file and call either of the ***initialize()*** of **\_MoEngageInitializer \_**instance in  ***applicationdidFinishLaunchingWithOptions()*** as shown below:

<Info>
  Make sure to set the correct Data Center while initializing the SDK. For more information, refer to the following [link](/developer-guide/flutter-sdk/sdk-integration/sdk-initialization/manual-initialization/data-center).
</Info>

<CodeGroup>
  ```swift Swift theme={"theme":{"light":"github-light","dark":"github-dark"}}
  /// Method to initialize MoEngage SDK
  /// - Parameters:
  ///   - config: MoEngageSDKConfig instance for SDK configuration
  ///   - launchOptions: Launch Options dictionary
  func initializeDefaultInstance(_ config: MoEngageSDKConfig, launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil)
  /// Method to initialize MoEngage SDK with SDK state
  /// - Parameters:
  ///   - config: MoEngageSDKConfig instance for SDK configuration
  ///   - sdkState: Bool indicating if SDK is Enabled/Disabled
  ///   - launchOptions: Launch Options dictionary
  func initializeDefaultInstance(_ config: MoEngageSDKConfig, sdkState: Bool = true, launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil)
  ```
</CodeGroup>

Sample code to initialize in ***applicationdidFinishLaunchingWithOptions()***

<CodeGroup>
  ```swift Swift theme={"theme":{"light":"github-light","dark":"github-dark"}}
  // Import SDK frameworks
  import moengage_flutter_ios
  import MoEngageSDK
  @UIApplicationMain
  @objc class AppDelegate: FlutterAppDelegate {
    override func application(
      _ application: UIApplication,
      didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
    ) -> Bool {
  //Workspace ID: You can be obtain it from App Settings in MoEngage Dashboard.
      let sdkConfig = MoEngageSDKConfig(withAppID: yourWorkspaceIDappId, dataCenter: DATA_CENTER) 
      sdkConfig.enableLogs = true
      MoEngageInitializer.sharedInstance.initializeDefaultInstance(sdkConfig, launchOptions: launchOptions)
      GeneratedPluginRegistrant.register(with: self)
      return super.application(application, didFinishLaunchingWithOptions: launchOptions)
    }
  }
  ```

  ```objectivec Objective-C theme={"theme":{"light":"github-light","dark":"github-dark"}}
  // Import SDK frameworks
  #import <MoEngageSDK/MoEngageSDK.h>
  #import <moengage_flutter_ios/moengage_flutter_ios-Swift.h>
  @implementation AppDelegate
  - (BOOL)application:(UIApplication *)application
  didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
      MoEngageSDKConfig* sdkConfig = [[MoEngageSDKConfig alloc] initWithAppID:@"Workspace ID"dataCenter: DATA_CENTER];
      sdkConfig.enableLogs = true;
     [[MoEngageInitializer sharedInstance] initializeDefaultInstance:sdkConfig launchOptions:launchOptions];
     [GeneratedPluginRegistrant registerWithRegistry:self];
     // Override point for customization after application launch.
     return [super application:application didFinishLaunchingWithOptions:launchOptions];
  }
  @end
  ```
</CodeGroup>

# Data Center

In case your app wants to redirect data to a specific zone due to any data regulation policy please configure the zone in the MOSDKConfig object.

For more information on Data Center, refer [here](/developer-guide/ios-sdk/sdk-integration/basic/data-center).
