iOS 10.x.x

For initializing the project, you'll need to provide the Workspace ID of your MoEngage App.

info

Note

Login to your MoEngage account, go to Settings in the left panel of the dashboard. Under App Settings, you will find your Workspace ID.

Code Initialisation

To initialize MoEngageSDK from application:didfinishlaunchingwithoptions call any one of the below initialization methods by passing MoEngageSDKConfig as parameter. Refer doc for more info on all the properties that can be configured using MoEngageSDKConfig 

Objective-C

Objective-C
/// @param sdkConfig MoEngageSDKConfig instance for SDK configuration
/// @param launchOptions Launch Options dictionary
- (void)initializeDefaultSDKConfig:(MoEngageSDKConfig*)sdkConfig andLaunchOptions:(NSDictionary*)launchOptions;
/// @param sdkConfig MoEngageSDKConfig instance for SDK configuration
/// @param isSdkEnabled Bool indicating if SDK is Enabled/Disabled
/// @param launchOptions Launch Options dictionary
- (void)initializeDefaultSDKConfigWithState:(MoEngageSDKConfig*)sdkConfig withSDKState:(MoEngageSDKState)sdkState andLaunchOptions:(NSDictionary*)launchOptions;

Sample code to initialize from application:didFinishLaunchingWithOptions: method:

Swift Objective-C
import MoEngageSDK  
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
      //Add your MoEngage Workspace ID and Data center.
       let sdkConfig = MoEngageSDKConfig(appId: "YOUR WorkspaceID", dataCenter: YOUR_DATA_CENTER)
       sdkConfig.consoleLogConfig = MoEngageConsoleLogConfig(isLoggingEnabled: true, loglevel: .verbose)
       MoEngageInitializer.sharedInstance().initializeDefaultSDKConfig(sdkConfig, andLaunchOptions: launchOptions)
      //Rest of the implementation of method
      //-------
      return true
}

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.

Refer to the Data Center documentation for more information.

Previous

Next

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

How can we improve this article?