The Sample Moe Developer Hub

Welcome to the Sample Moe developer hub. You'll find comprehensive guides and documentation to help you start working with Sample Moe as quickly as possible, as well as support if you get stuck. Let's jump right in!

SDK Integration

How to integrate iOS SDK into your app

There are two ways you can integrate the SDK - CocoaPods or Manual integration. We recommend CocoaPods.

IMPORTANT :

  • The current SDK supports iOS8 and above

  • MoEngage SDK supports rich notifications for iOS10, and hence uses UserNotifications Framework available from iOS SDK 10 onwards for the same. Upgrade Xcode to version 8 or above to use our iOS SDK version 3.0+

Integration through CocoaPods

Cocoapods is a dependency manager for Objective C & Swift projects and makes integration easier.

  1. If you don't have cocoapods installed, you can do it by executing the following line in your terminal.
sudo gem install cocoapods
  1. If you don't have a Podfile, create a plain text file named Podfile in the Xcode project directory with the following content, making sure to set the platform and version that matches your app.
pod 'MoEngage-iOS-SDK'

If you are using use_frameworks! (dynamic framework) then add the code below in your Podfile


use_frameworks!

pod 'MoEngage-iOS-SDK'

# if using use_frameworks! , add the code below:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      if target.name == “MoEngage-iOS-SDK"
        config.build_settings["OTHER_LDFLAGS"] = '$(inherited) "-ObjC"'
      end
    end
  end
end
  1. Install MoEngage SDK by executing the following in the Xcode project directory.
pod install
  1. Now, open your project workspace and check if MoEngage SDK is properly added.

Manual Integration

To install manually, follow the steps below:

  1. Download the latest sdk from the following link.

  2. Add the given library file (.a extension) from MoEngageSDK folder to your project.

  3. Add the given header files (.h extensions) from MoEngageSDK folder, by dragging and dropping the files in to your project.

  4. Add the following compiler flag: -ObjC. Select your project. Go to “Build Settings” ->”Linker” ->”Other Linker Flags” and add this flag.

Using SDK in Swift

If you are not using dynamic frameworks:

Simply add the MoEngage-iOS-SDK/MoEngage.h and other header files as needed, in your bridging header and you will be good to go.

#import <MoEngage-iOS-SDK/MoEngage.h>
#import <MoEngage-iOS-SDK/MOInbox.h>
#import <MoEngage-iOS-SDK/MOEHelperConstants.h>
#import <MoEngage-iOS-SDK/MOGeofenceHandler.h>

If you are using dynamic frameworks:

Here you will have to import the SDK by directly using an import statement as below:

// This will import all the necessary modules including Inbox and Geofence
import MoEngage_iOS_SDK

Note:

Please note that prior to building for the first time, Xcode may display an error: No such module found ‘MoEngage_iOS_SDK’. Upon your first successful build this error should disappear and MoEngage will be integrated within your Swift app!

If this doesn't work as well, make sure you have made changes to Podfile as mentioned in the CocoaPods section.


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

SDK Integration

How to integrate iOS SDK into your app