iOS MA SDK Integration Guide (Before 5.5.0)

Applicable Versions

This guide applies to MTMA SDK versions from v5.0.0 up to, but excluding, v5.5.0. The SDK currently supports iOS 10 and later.

For v5.5.0 and later, see the Integration Guide.

To use the MA features of the EngageLab SDK, you must also integrate the AppPush module. First, create an application on the AppPush platform to obtain an AppKey.

Configure the Project

Configure AppPush

When configuring a mobile data source in the MA console, select the option to also use AppPush and choose the AppPush application actually integrated. Initialize AppPush with that application’s AppKey.

Import the SDK

Import via CocoaPods

  • Specify a version earlier than 5.5.0 (5.0.0 in this example):
pod 'MTPush', '5.0.0' pod 'MTMA', '5.0.0'
              
                  pod 'MTPush', '5.0.0'
    pod 'MTMA', '5.0.0'

            
This code block in the floating window

Manual Import

  • Extract the corresponding legacy SDK package. After importing AppPush as described in its integration guide, select “Add files to 'Your project name'...” in Xcode and add MTMA-ios-x.x.x.xcframework from the same SDK package to your project directory.

Initialize the SDK

Initialize the MTMA SDK after calling the MTPush initialization function. Legacy MTMA uses the AppPush AppKey; no separate MA AppKey is required.

Add the following header files to AppDelegate.m:

#import "MTPushService.h" #import "MTMAService.h"
              
              #import "MTPushService.h"
#import "MTMAService.h"

            
This code block in the floating window
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Initialize the Push SDK first NSString *appKey = @"your AppPush AppKey"; NSString *channel = @"App Store"; BOOL isProduction = NO; [MTPushService setupWithOption:launchOptions appKey:appKey channel:channel apsForProduction:isProduction advertisingIdentifier:nil]; // Then initialize the MTMA SDK MTMAConfig *config = [[MTMAConfig alloc] init]; config.completion = ^(NSInteger code, NSString *message) { NSLog(@"result:%ld - %@", (long)code, message); }; [MTMAService start:config]; return YES; }
              
              - (BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    // Initialize the Push SDK first
    NSString *appKey = @"your AppPush AppKey";
    NSString *channel = @"App Store";
    BOOL isProduction = NO;
    [MTPushService setupWithOption:launchOptions
                           appKey:appKey
                          channel:channel
                 apsForProduction:isProduction
            advertisingIdentifier:nil];

    // Then initialize the MTMA SDK
    MTMAConfig *config = [[MTMAConfig alloc] init];
    config.completion = ^(NSInteger code, NSString *message) {
        NSLog(@"result:%ld - %@", (long)code, message);
    };
    [MTMAService start:config];

    return YES;
}

            
This code block in the floating window
Selected Parameters
  • appKey
    • Ensure that the appKey configured in the app matches the AppKey generated when you created the application on the AppPush platform.
  • channel
    • Specifies the download channel of the application package. Define the value yourself, such as App Store, to facilitate statistics by channel.
  • apsForProduction
    • Identifies the APNs certificate environment used by the current app.
    • 0 (default) indicates a development certificate; 1 indicates a production certificate for publishing the app.
    • Note: This value must match the certificate environment configured under Code Signing in Build Settings.
  • completion
    • Initialization result callback. A code of 0 indicates successful initialization.
Icon Solid Transparent White Qiyu
Contact Sales