-
Notifications
You must be signed in to change notification settings - Fork 20
Migrate from Mobile Engage
This is a guide on how to move from the Mobile Engage SDK to the new Emarsys SDK. This guide only covers the actual migration from the Mobile Engage SDK to the Emarsys SDK, please look at the README for more general details on how to get started with the Emarsys SDK.
In the Podfile configuration you need to remove the dependency to MobileEngage and the CoreSDK and add the new EmarsysSDK.
pod 'MobileEngageSDK'
pod 'CoreSDK'
↓
pod 'EmarsysSDK', :git => '[email protected]:emartech/ios-emarsys-sdk.git', :tag => '1.99.0'
The MEEventHandler
interface was renamed to EMSEventHandler
.
class AppDelegate: UIResponder, UIApplicationDelegate, MEEventHandler {
...
}
↓
class AppDelegate: UIResponder, UIApplicationDelegate, EMSEventHandler {
...
}
A call of MobileEngage.appLogin
without parameters is no longer necessary. You no longer login anonymously, instead upon registering your device, we will automatically create an anonymous contact if we never saw this device.
The workflow for linking a device to a contact was changed slightly. Instead of passing both the contactFieldId and the contactFieldValue when the user logs in, you now only need to send the contactFieldValue. The contactFieldId is set once during the configuration of the EmarsysSDK.
MobileEngage.appLogin(contactFieldId, contactFieldvalue)
↓
let config = EMSConfig.make { builder in
...
builder.setContactFieldId(contactFieldId)
...
}
Emarsys.setContactWithContactFieldValue(contactFieldValue)
MobileEngage.appLogout()
↓
Emarsys.clearContact()
MobileEngage.setPushToken(deviceToken)
↓
Emarsys.push.setPushToken(deviceToken)
If you were calling the setPushToken
method with null
in order to remove the token you need to change those calls to use the dedicated method removePushToken
instead.
MobileEngage.setPushToken(null)
↓
Emarsys.push.removePushToken()
MobileEngage.trackMessageOpen(userInfo)
↓
Emarsys.push.trackMessageOpen(userInfo)
The MobileEngage.statusDelegate
property was removed, you can now specify a completion block for each method instead.
MobileEngage.statusDelegate = self
↓
Emarsys.push.setPushToken(token) { (err) in
...
}