Migration to SDK version 8.2.0

We have made some major changes in SDK version 8.2.0 and if you are someone who was using an older version of our SDK and planning to move to version 8.2.0 or above here are the changes to be made while migrating:

Update the Pod names

From SDK version 8.2.0 , we have updated some of the pod names. Refer to the table below to update the podfile.

SDK Version 7.0.0 SDK Version 8.2.0
import MOGeofence

import MoEngageGeofence

import MORichNotification

import MoEngageRichNotification

Update the Import

From SDK version 8.2.0 , we have updated some of the framework names. Refer to the table below to update the import statement for the modules.

SDK Version 7.0.0 SDK Version 8.2.0
import MoEngage

import MoEngageSDK

import MOInApp

import MoEngageInApps

import MOCards

import MoEngageCards

import MOGeofence

import MoEngageGeofence

import MORichNotification

import MoEngageRichNotification

Initialisation Method Changes

We have deprecated the previous initialization methods and have introduced new methods. 

Deprecated methods

Swift Objective-C
let sdkConfig = MOSDKConfig(withAppID: "YOUR Workspace ID")
#if DEBUG
	MoEngage.sharedInstance().initializeTest(with: sdkConfig, andLaunchOptions: launchOptions)
#else
	MoEngage.sharedInstance().initializeLive(with: sdkConfig, andLaunchOptions: launchOptions)
#endif

For info on the new initialization methods, refer to this link.

Setting Region/Data Center

MODataCenter: DataCenter names have been updated in the SDK version 8.2.0. Following are the existing ones used in SDK version in 7.0.0 and above.

Swift Objective-C
typedef enum {              
      DATA_CENTER_01, 
      DATA_CENTER_02, 
      DATA_CENTER_03 
}MODataCenter;

For info on the new DataCenter value, refer to this link.

App Target: Setting App Group ID

App Group ID for App target was earlier set using setAppGroupID:, which is no longer supported. Make use of the MOSDKConfig to configure the same in the latest SDK versions(Refer link for more info)

Older method[6.3.1 and below]

Swift Objective-C
MoEngage.setAppGroupID("AppGroupID")

Enable Logs Changes

For troubleshooting, the method to enable SDK logs has been changed from debug: to enableSDKLogs :. The earlier method was used as shown below, and for the updated implementation in the latest SDK versions refer to the following doc:

Older method[6.3.1 and below]

Swift Objective-C
MoEngage.debug(LOG_ALL)

Tracking User Attributes

From SDK version 8.2.0 , we have deprecated couple of UserAttribute methods. Refer to the table below to get the updated method

SDK Version 7.0.0 SDK Version 8.2.0
MoEngage.sharedInstance().setUserUniqueID(UNIQUE_ID)

MOAnalytics.sharedInstance.setUniqueID(UNIQUE_ID)

MoEngage.sharedInstance().setUserName(userName)

MOAnalytics.sharedInstance.setName(userName)

MoEngage.sharedInstance().setUserLastName(userLastname)

MOAnalytics.sharedInstance.setLastName(userLastname)

MoEngage.sharedInstance().setUserFirstName(userFirstName)

MOAnalytics.sharedInstance.setFirstName(userFirstName)

MoEngage.sharedInstance().setUserEmailID(userEmailID)

MOAnalytics.sharedInstance.setEmailID(userEmailID)

MoEngage.sharedInstance().setUserMobileNo(userPhoneNo)

MOAnalytics.sharedInstance.setMobileNumber(userPhoneNo)

MoEngage.sharedInstance().setUserGender(MALE)

MOAnalytics.sharedInstance.setGender(.male)

MoEngage.sharedInstance().setUserDateOfBirth(userBirthdate)

MOAnalytics.sharedInstance.setDateOfBirth(userBirthdate)

MoEngage.sharedInstance().setUserLocationLatitude

(userLocationLat, andLongitude: userLocationLng)

MOAnalytics.sharedInstance.setLocation(MOGeoLocation(withLatitude: userLocationLat, andLongitude: userLocationLng))

MoEngage.sharedInstance().setUserAttributeISODateString

("2020-01-12T18:45:59Z", forKey: "DateAttr2")

MOAnalytics.sharedInstance.setUserAttributeISODate("2020-01-12T18:45:59Z", withAttributeName: "Date Attr 2")e

MoEngage.sharedInstance().setUserAttributeTimestamp

(NSDate().timeIntervalSince1970, forKey:"DateAttr3")

MOAnalytics.sharedInstance.setUserAttributeEpochTime(663333, withAttributeName: "Date Attr 3")

MoEngage.sharedInstance().setUserAttributeLocationLatitude

(12.98798, longitude: 34.98789, forKey:"location_attribute_name")

MOAnalytics.sharedInstance.setLocation(MOGeoLocation.init(withLatitude: 72.90909, andLongitude: 12.34567), withAttributeName: "attribute name")

For info on tracking user attributes methods, refer to this doc

Push Notification

From SDK version 8.2.0 , we have updated methods related to Push Notification.Refer to the table below to use the updated one.

SDK Version 7.0.0 SDK Version 8.2.0
MoEngage.sharedInstance().disableBadgeReset = true

MoEngage.sharedInstance().setDisableBadgeReset(true)

MORichNotification.handle(request, withContentHandler: contentHandler)

MORichNotification.handle(richNotificationRequest: request, withContentHandler: contentHandler)

MOPushTemplateHandler.sharedInstance().addPushTemplate(to: self, with: notification)

MORichNotification.addPushTemplate(toController: self, withNotification: notification)

//Set messaging delegate

MOMessaging.sharedInstance().messagingDelegate = self

//Set messaging delegate

MOMessaging.sharedInstance.setMessagingDelegate(self)

RealTimeTrigger and Inbox Module

From SDK version 8.0.0, RealTimeTrigger and Inbox Module is separated from the MoEngage-iOS-SDK.Hence it must be integrated explicitly. Refer to the link for the doc.

Location Triggered

From SDK version 8.2.0 , we have updated methods related to Geofence. Refer to the table below to use the updated one.

SDK Version 7.0.0 SDK Version 8.2.0
MOGeofenceHandler.sharedInstance()?.startGeofenceMonitoring()

MOGeofence.sharedInstance.startGeofenceMonitoring()

MOGeofenceHandler.sharedInstance().delegate = self

MOGeofence.sharedInstance.setGeofenceDelegate(self)

For more info on Geofence feature, refer to this doc

InApp

From SDK version 8.2.0 , we have updated methods related to InApp.Refer to the table below to use the updated one.

SDK Version 7.0.0 SDK Version 8.2.0
MOInApp.sharedInstance().show()

MOInApp.sharedInstance().showCampaign()

MOInApp.sharedInstance().inAppDelegate = self;

MOInApp.sharedInstance().setInAppDelegate(self)

For more info on InApp feature, refer to this doc

Cards

From SDK version 8.0.0 , we have updated methods related to Cards.Refer to the table below to use the updated one.

SDK Version 7.0.0 SDK Version 8.2.0

MoEngageCards.sharedInstance.pushCardsViewController

(toNavigationController: self.navigationController!)

MOCards.sharedInstance.pushCardsViewController

(toNavigationController: self.navigationController!)

MoEngageCards.sharedInstance.presentCardsViewController()

MOCards.sharedInstance.presentCardsViewController()

MoEngageCards.sharedInstance.getCardsViewController()

MOCards.sharedInstance.getCardsViewController(withUIConfiguration: nil, withCardsViewControllerDelegate: self, forAppID: "YOUR Workspace ID") { cardsController in print("fetched CardsController") }

MoEngageCards.sharedInstance.getNewCardsCount()

MOCards.sharedInstance.getNewCardsCount(forAppID: "YOUR Workspace ID", withCompletionBlock: { count, accountMeta in print("Card count is \(count)") })

MoEngageCards.sharedInstance.getUnclickedCardsCount()

MOCards.sharedInstance.getUnclickedCardsCount(forAppID: "YOUR Workspace ID") { count, accountMeta in print("UnClicked Card count is \(count)") }

MoEngageCards.sharedInstance.cardsDelegate = delegate

MOCards.sharedInstance.setCardsDelegate(delegate: self)

For more info on Cards feature, refer to this doc.

Previous

Next

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

How can we improve this article?