iOS Installation

SDK Installation

Installation using CocoaPods(Plugin Version 5.0.0 and above)

Starting from cordova-ios version 4.3.0 and cordova-cli version 6.4.0, CocoaPod support is provided to bundle any iOS framework. Therefore, we have updated our plugin too to support this from version 5.0.0.

Cocoapods is a dependency manager for iOS projects and makes integration easier. If you don't have cocoapods installed, you can do it by executing the following command in your terminal:

sudo gem install cocoapods

Here, after adding the plugin just go to the ios folder in platforms and run pod install command to integrate our MoEngagePluginBase:

pod repo update
pod install


Add script to remove Unwanted Architectures

Do this if not already done: Select App Target and go to Build Phase and add a Run Script step to your build steps, set it to use /bin/sh and enter the following script:


# This script loops through the frameworks embedded in the application and
# removes unused architectures.
find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
    FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
    echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"


    for ARCH in $ARCHS
        echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"

    echo "Merging extracted architectures: ${ARCHS}"
    lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}"
    rm "${EXTRACTED_ARCHS[@]}"

    echo "Replacing original executable with thinned version"


This script is for removing unsupported architectures while exporting the build OR submitting app to the app store.



For Plugin version 3.2.0 and below:

Open your project in Xcode, select your project. Go to Build Settings -> Linker -> Other Linker Flags and add -ObjC flag.

SDK Initialization

Code Initialization

From plugin version 8.0.0 we support initialization only via code. In the version 8.0.0 we have removed the initialization of SDK support via info.plist which was supported in 7.1.1 and above.

  • Call any one of the below-given initialization methods in application:didFinishLaunchingWithOptions: method. The method accepts the MOSDKConfig instance as its parameter. Refer doc for more info on all the properties which can be configured using MOSDKConfig.
    /// @param sdkConfig MOSDKConfig instance for SDK configuration
    /// @param launchOptions Launch Options dictionary
    - (void)initializeDefaultSDKConfig:(MOSDKConfig*)sdkConfig andLaunchOptions:(NSDictionary*)launchOptions;
    /// @param sdkConfig MOSDKConfig instance for SDK configuration
    /// @param isSdkEnabled Bool indicating if SDK is Enabled/Disabled
    /// @param launchOptions Launch Options dictionary
    - (void)initializeDefaultSDKConfig:(MOSDKConfig*)sdkConfig withSDKState:(BOOL)isSdkEnabled andLaunchOptions:(NSDictionary*)launchOptions;
  • Sample code to initialise from application:didFinishLaunchingWithOptions: method:
    #import "AppDelegate.h"
    #import "MainViewController.h"
    // Make sure to import "AppDelegate+MoEngage.h"
    #import "AppDelegate+MoEngage.h"
    @implementation AppDelegate
    - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
        self.viewController = [[MainViewController alloc] init];
        MOSDKConfig *sdkConfig = [[MOSDKConfig alloc] initWithAppID: @"Your MoEngage App ID"];
        sdkConfig.moeDataCenter = DATA_CENTER_01; // Possible Values DATA_CENTER_01/DATA_CENTER_02/ DATA_CENTER_03
        sdkConfig.appGroupID = "App Group ID";
        // ---
        // Update other Parameters of SDK Config
        [self initializeDefaultSDKConfig:sdkConfig andLaunchOptions:launchOptions];
        return [super application:application didFinishLaunchingWithOptions:launchOptions];


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