Manual Integration in Swift

Prev Next

Goal

Manually integrate the Mapp Engage SDK into your iOS app using Swift.

Note:

  • This guide covers manual integration for advanced users who need greater customization.

  • For basic integration, see the Basic Automated Setup.


Prerequisites

Before starting, ensure you have:

  1. Xcode with:

    • A base SDK of iOS 12 or above

    • A deployment target of iOS 12 or above

  2. A Mapp Engage Account with the mobile channel activated.

  3. Required permissions configured in your app's Info.plist.


Procedure

Step 1: Download the SDK

Download the SDK.

Step 2: Add the SDK to Your Project

Drag AppoxeeSDK.xcframework into your project.

Step 3: Import the SDK in AppDelegate

  • Open your AppDelegate.swift file and add:

import AppoxeeSDK

Step 4: Initialize the SDK

Add the following to the application(_:didFinishLaunchingWithOptions:) method:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    Appoxee.shared().engage(withLaunchOptions: launchOptions, andDelegate: self, andSDKID: "xxx.xxx", with: .L3)

    // Insert other initialization code or other Frameworks code here.

    return true
}
  • Replace xxx.xxx with the SDK Key configured in your Mapp Engage Channel Configuration.

  • The with parameter is the SERVER enum. Customer-facing values are L3, EMC, EMC_US, and CROC. Your account manager will tell you which one to use.

Note:

The SERVER enum also defines TEST, TEST55, and TEST61 values. These are internal test environments and are not meant for production use.

Step 5: Handle Notifications

Implement the following methods to handle push notifications:

  • Register Device Token:

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
    Appoxee.shared().didRegister(forRemoteNotificationsWithDeviceToken: deviceToken)
}
  • Receive Remote Notifications:

func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
    Appoxee.shared().receivedRemoteNotification(userInfo)
    completionHandler(.newData)
}

Step 6: Custom Delegate (Optional)

Handle custom push actions by implementing:

// MARK: - AppoxeeNotificationDelegate
func appoxee(_ appoxee: Appoxee, handledRemoteNotification pushNotification: APXPushNotification, andIdentifer actionIdentifier: String) {
    // A push notification was received and processed.
}

Warning:

The selector appoxee:handledRemoteNotification:andIdentifer: contains a typo (Identifer without the second i) in the public header. Use the selector exactly as shown — it matches the symbol exported by AppoxeeSDK.xcframework.