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:
Xcode with:
A base SDK of iOS 12 or above
A deployment target of iOS 12 or above
A Mapp Engage Account with the mobile channel activated.
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.swiftfile and add:
import AppoxeeSDKStep 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.xxxwith the SDK Key configured in your Mapp Engage Channel Configuration.The
withparameter is theSERVERenum. Customer-facing values areL3,EMC,EMC_US, andCROC. Your account manager will tell you which one to use.
Note:
The
SERVERenum also definesTEST,TEST55, andTEST61values. 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 (Identiferwithout the secondi) in the public header. Use the selector exactly as shown — it matches the symbol exported byAppoxeeSDK.xcframework.