There are two ways you can integrate the SDK - CocoaPods or Manual integration. We recommend CocoaPods.
IMPORTANT :
The current SDK supports iOS8 and above
Refer to sample project for queries regarding integration of MoEngage iOS SDK
For complete API reference of the SDK, refer to the docs in this link
Cocoapods is a dependency manager for Objective C & Swift projects and makes integration easier.
- If you don't have cocoapods installed, you can do it by executing the following line in your terminal.
sudo gem install cocoapods
- If you don't have a Podfile, then create one by using
pod init
command. Post this addMoEngage-iOS-SDK
pod to your pod file as shown below:
pod 'MoEngage-iOS-SDK','~> 5.0'
- Integrate MoEngage iOS SDK by executing the following in the terminal at your project's root directory:
pod repo update
pod install
- Now, open your project workspace and check if MoEngage SDK is properly added.
To install manually, follow the steps below:
Download the latest sdk from the following link.
Add the MoEngage.framework file to your project.
Add
MoEngage
framework to Embedded BinariesDo 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 app store.
What's Next
Awesome, you are all set to use MoEngage now. Next we will see how to initialize MoEngage SDK and changes that are to be made to your AppDelegate file.
AppDelegate Changes |