-
Notifications
You must be signed in to change notification settings - Fork 20
Integrate the SDK with EMSAppDelegate
dschuppa edited this page Jul 28, 2021
·
4 revisions
We created an easier solution to integrate Emarsys SDK by inheriting from our EMSAppDelegate. We created EMSAppDelegate to make the integration of Emarsys SDK more convenient. By inheriting from this class every step of the setup process is handled by us.
Note
Please complete the required steps before proceeding
The only thing you have to do is to provide us an EMSConfig by the dedicated method which you have to implement.
Note
If you need to add something to the original AppDelegate methods, you simply have to override those methods
and call super
.
This results in a very simplified AppDelegate:
#import <Foundation/Foundation.h>
#import "EMSAppDelegate.h"
@interface AppDelegate : EMSAppDelegate
@end
#import "AppDelegate.h"
#import "EMSConfig.h"
@implementation AppDelegate
- (EMSConfig *)provideEMSConfig {
EMSConfig *config = [EMSConfig makeWithBuilder:^(EMSConfigBuilder *builder) {
[builder setContactFieldId:<contactFieldId: NSNumber>];
[builder setMobileEngageApplicationCode:<applicationCode: NSString>];
[builder setMerchantId:<predictMerchantId: NSString>];
}];
return config;
}
@end
import EmarsysSDK
@UIApplicationMain
class AppDelegate: EMSAppDelegate {
override func provideEMSConfig() -> EMSConfig! {
return EMSConfig.make { builder in
builder.setMobileEngageApplicationCode(<applicationCode: String>)
builder.setMerchantId(<merchantId: String>)
}
}
}