Intergration Guide
Last updated:2025-03-18
Applicable Versions
Version v5.0.0 and later. Currently, the SDK only supports mobile phone systems with iOS 10 or higher.
To use the MA function of the EngageLab SDK, you need to integrate the AppPush module simultaneously. Please create an application on the AppPush platform first to obtain the AppKey.
Configure the Project
Import the SDK
Import via Cocoapods
pod 'MTMA'
Note: If you cannot import the latest version, please execute the command pod repo update master to upgrade the local pod library, and then pod 'MTMA' again.
pod 'MTMA'
Note: If you cannot import the latest version, please execute the command pod repo update master to upgrade the local pod library, and then pod 'MTMA' again.
This code block in the floating window
- If you need to install a specified version, use the following method (taking the MTMA 5.0.0 version as an example):
pod 'MTMA', '5.0.0'
pod 'MTMA', '5.0.0'
This code block in the floating window
Manual Import
- Unzip the SDK package. In Xcode, select “Add files to 'Your project name'...”, and add the MTMA-ios-x.x.x.xcframework to your project directory.
Initialize the SDK
Initialize the MTMA SDK after calling the MTPush initialization function
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Initialize the Push sdk first
NSString *advertisingId = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
[MTPushService setupWithOption:launchOptions appKey:appKey
channel:channel
apsForProduction:isProduction
advertisingIdentifier:advertisingId];
// Then initialize the MTMA SDK
MTMAConfig *config = [[MTMAConfig alloc] init];
config.completion = ^(NSInteger code, NSString * _Nonnull message) {
NSLog(@"result:%ld - %@", code, message);
};
[MTMAService start:config];
}
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Initialize the Push sdk first
NSString *advertisingId = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
[MTPushService setupWithOption:launchOptions appKey:appKey
channel:channel
apsForProduction:isProduction
advertisingIdentifier:advertisingId];
// Then initialize the MTMA SDK
MTMAConfig *config = [[MTMAConfig alloc] init];
config.completion = ^(NSInteger code, NSString * _Nonnull message) {
NSLog(@"result:%ld - %@", code, message);
};
[MTMAService start:config];
}
This code block in the floating window
Explanation of Some Parameters
- appKey
- Please ensure that the appkey configured in the application is consistent with the appkey generated after creating the application on the Portal.
- channel
- Specifies the download channel of the application package. For the convenience of channel-based statistics, you can define the specific value by yourself, such as: App Store.
- apsForProduction
- Used to identify the APNs certificate environment used by the current application.
- 0 (default value) indicates that a development certificate is used, and 1 indicates that a production certificate is used to release the application.
- Note that the value of this field should be consistent with the certificate environment configured in Code Signing of Build Settings.