SDK Installation
Install using Swift Package Manager
MoEngageInbox is supported through SPM from SDK version 1.2.0. To integrate, use the GitHub url https://github.com/moengage/apple-sdk.git for SDK versions equal and above 9.23.0, or https://github.com/moengage/MoEngage-iOS-SDK.git for other SDK versions link and set the branch as master or required version.Install using CocoaPod
InformationCocoaPods is being deprecated. MoEngage recommends using Swift Package Manager for all new integrations. For more info on CocoaPods, refer to CocoaPods Integration Guide.
pod install to install the framework
Inbox Setup Checklist
Make sure the following items are implemented before using the Inbox Module:- Update the MoEngage-iOS-SDK to version >= 9.0.0
- Integrate the MoEngageInbox module of version >= 2.0.0
- Implement Notification Service Extension and Integrate MoEngageRichNotifcation(>= 7.0.0).
- AppGroupID is set in App Target Capabilities and the same is passed to the SDK.
- AppGroupID is set in Notification Service Extension Target Capabilities and the same is passed to the MoEngageRichNotification SDK.
How to use Inbox?
-
Import
MoEngageInboxin your View Controller. - Create a property - @property(nonatomic, strong) MoEngageInboxViewController *inboxController.
-
In viewDidLoad, add the below code to fetch MoEngageInboxViewController
Push/Present the MoEngageInboxViewController
In order for the SDK to handle the transition, use one of the methods.MoEngageInboxViewControllerDelegate Methods
Use MoEngageInboxViewControllerDelegate protocol for getting the callbacks from the Inbox Module:Customizing Appearance
- You can push/present your controller. If you push your controller, make sure to add “Done” or “Cancel” button as a UIBarButtonItem to dismiss your View Controller.
- You can get the delegate callback of the click action on inbox cells.
- You can use this data for tracking events or navigation to another screen.
-
You can customize the look and feel of the inbox view controller using the method:
Self Handled Inbox
Fetch Inbox Messages:
Inbox can be completely customized now. Use getInboxMessages(forAppID:withCompletionBlock:) to fetch the inbox messages.Mark a notification as Read:
An inbox notification can be marked as read with the method markInboxNotificationClicked(withCampaignID:forAppID:completionHandler) by providing the campaign ID of the notification while calling the method. The method will return the updated notification payload where theisRead key will be set to true.
Track Inbox Notification Clicks:
An inbox notification click can be tracked by using method trackInboxClick(withCampaignID:forAppID:) by providing the campaign ID of the notification while calling the method.Process the Inbox Clicks:
If you want to perform the actions supported by the SDK(i.e, rich landing, deep linking, coupon code etc) associated with the notifications on clicking the entry in Inbox call processInboxNotification(withCampaignID:forAppID:) method as shown below.Get Unread Notifications count:
You can obtain the unread notifications count from the Inbox by using getUnreadNotificationCount(forAppID:withCompletionBlock:) method as shown below:Deleting Messages
Use removeInboxMessages(forAppID:completionHandler:) method to remove all the messages currently stored in inbox.Methods deprecated in SDK version 4.4.0
We have revamped the Inbox Module in the SDK version 4.4.0 and following this, we have deprecatedMOInboxPushDataModel class and use MOInboxModel class instances as the model object for notifications. Along with this, we have also deprecated few of the existing methods of MOInbox as listed below:
InformationThe MoEngage SDK only synchronizes push data with the Notification Center when the app is launched for the first time or when it returns to the foreground from the background.