What does [[CleverTap sharedInstance] handleNotificationWithData:userInfo] do?



I was integrating CleverTap react native sdk into our company’s app and realized that there is a problem between React Native Firebase and CleverTap sdk. Basically:

RNFirebaseNotifications calls

[UNUserNotificationCenter currentNotificationCenter].delegate = self;

which stops Clevertap from processing the notification, for example, in this code:

  • (void)application:(UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo

fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler{

if ([[CleverTap sharedInstance] isCleverTapNotification:userInfo]) {

NSLog(@"didReceiveRemoteNotification - type: CleverTapNotification");

[[CleverTap sharedInstance] handleNotificationWithData:userInfo];


} else {
// app custom logic


I have reached out to firebase and they don’t have any solution right now to toggle the delegate. I also have looked at CleverTap js interface and this method [[CleverTap sharedInstance] handleNotificationWithData:userInfo];
has not been exposed yet (so I can’t call it in my js code after receiving the notification event from firebase).
My question is what exactly does handleNotificationWithData do? What will I miss out by not calling that function to process the notification?



Hey @anguyen

iOS 10 has introduced the UNUserNotificationCenterDelegate for handling notifications and seems like you the using the same to manage all notification-related behaviors in your app.

UNUserNotificationCenter calls the delegate’s userNotificationCenter(_:didReceive:withCompletionHandler:) method to process the user’s response to a notification.

CleverTap handleNotificationWithData: method records notification opens and fire attached deep links.

I recommend that you must call the handleNotificationWithData: to track notification open and fire any deep links if contained in the payload

Code snippet for the same:

- (void)userNotificationCenter:(UNUserNotificationCenter *)center
didReceiveNotificationResponse:(UNNotificationResponse *)response
         withCompletionHandler:(void (^)())completionHandler {
     Use this method to perform the tasks associated with your app’s custom actions. When the user responds to a notification, the system calls this method with the results. You use this method to perform the task associated with that action, if at all. At the end of your implementation, you must call the completionHandler block to let the system know that you are done processing the notification.
     You specify your app’s notification types and custom actions using UNNotificationCategory and UNNotificationAction objects. You create these objects at initialization time and register them with the user notification center. Even if you register custom actions, the action in the response parameter might indicate that the user dismissed the notification without performing any of your actions.
     If you do not implement this method, your app never responds to custom actions.
     see https://developer.apple.com/reference/usernotifications/unusernotificationcenterdelegate/1649501-usernotificationcenter?language=objc
    // if you wish CleverTap to record the notification open and fire any deep links contained in the payload
    [[CleverTap sharedInstance] handleNotificationWithData:response.notification.request.content.userInfo];