MoEngage Docs

iOS SDK Installation

Installation via. 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 onwards.

Cocoapods is a dependency manager for Objective C & Swift projects and makes integration easier. If you don't have cocoa pods installed, you can do it by executing the following line in your terminal:

sudo gem install cocoapods

Here, after adding the plugin just go to the ios folder in platforms and run pod installcommand to integrate our MoEPluginBase:

pod repo update
pod install

Bundled Integration(Only for Plugin Version 4.2.0 and below)

MoEngage Framework in Embedded Binaries

Ensure that the MoEngage.framework is present in Embedded Binaries(General > Embedded Binaries ). If not present then add the same.

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:

APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"

# 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
do
    FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
    FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
    echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"

    EXTRACTED_ARCHS=()

    for ARCH in $ARCHS
    do
        echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"
        lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
        EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
    done

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

    echo "Replacing original executable with thinned version"
    rm "$FRAMEWORK_EXECUTABLE_PATH"
    mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"

done

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.

Updated 2 months ago


iOS SDK Installation


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.