Manual Integration in Objective-C
    • 1 Minute to read
    • Dark
      Light

    Manual Integration in Objective-C

    • Dark
      Light

    Article summary

    Goal

    Manually integrate the Mapp SDK into your iOS app using Objective-C.

    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 11 or above

      • A deployment target of iOS 11 or above

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

    3. Ensure all required permissions are configured in your app's Info.plist.

    Procedure

    1. Download the SDK.

    2. Add the SDK to Your Project

      • Drag the AppoxeeSDK.framework or AppoxeeSDK.xcframework into your project.

    3. Import the SDK in AppDelegate

      • Open your AppDelegate.m file and add:

        #import <AppoxeeSDK/AppoxeeSDK.h>
      • If you're using the .xcframework version, the import statement should look like:

        #import "AppoxeeSDK.h"
      • Declare the delegate in @interface:

        @interface AppDelegate() <AppoxeeNotificationDelegate>
        @end
    4. Initialize the SDK: Add the following to the application:didFinishLaunchingWithOptions: method:

      - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
          [[Appoxee shared] engageWithLaunchOptions:launchOptions andDelegate:self andSDKID:@"xxx.xxx" with: L3];
          
          // Insert other initialization code or other Frameworks code here.
      
          return YES;
      }
      • Replace xxx.xxx with the SDK Key configured in your Mapp Engage Channel Configuration.

      • The parameter with represents enum SERVER that enables you to choose one of the four options: L3, EMC, L3_US, EMC_US.

        The account manager will provide you with the info on which one you should use in your application.

    5. Handle Notifications: Implement the following methods to handle push notifications:

      • Register Device Token:

        - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
            [[Appoxee shared] didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
        }
      • Receive Remote Notifications:

        - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
            [[Appoxee shared] receivedRemoteNotification:userInfo];
        }
      • Handle Push Actions (Optional for iOS 8+):

        - (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void (^)())completionHandler {
            BOOL didHandle = [[Appoxee shared] handleActionWithIdentifier:identifier forRemoteNotification:userInfo completionHandler:completionHandler];
        
            if (!didHandle) {
                // Handle any remaining actions
                completionHandler();
            }
        }
    6. Additional Delegate Methods: To handle silent notifications or additional delegate calls, consider implementing:

      • Silent Notifications: Documentation for silent push notifications is provided with the SDK.

      • Custom Delegates:

        #pragma mark - AppoxeeDelegate
        - (void)Appoxee:(Appoxee *)appoxee handledRemoteNotification:(APXPushNotification *)pushNotification andIdentifer:(NSString *)actionIdentifier {
            // A push notification was received and processed.
        }

    Troubleshooting

    1. Framework Not Found: Ensure the framework is linked correctly in the "Build Phases" tab of your Xcode project.

    2. Push Notifications Not Working: Double-check your APNs certificate and Appoxee Dashboard settings.

    3. Compile Errors: Confirm import paths and SDK version compatibility.


    Was this article helpful?