Push notifications are not displaying when app is in foreground

I have some C++ code to embed in my Application and hence enabling the setting C++ and Objective C ++ compatibility settings to C++/objective-C++ under build settings of my project .Once I enable it I am not receiving any push notification display when I'm in foreground even though I have the required willPresent function handler in app delegate. Also observed that the code is going into didReceiveRemoteNotification function handler.

But once I disable the setting or change the setting to c/objective-c,then the flow is working fine and I'm getting the push notification on foreground. Request you to please help me here

It is difficult to guess what might be going wrong with your code once the C++ compatibility setting is being turned on, but for the notification to be shown when the app is in the foreground, you need to be calling the completionHandler in willPresent with the appropriate UNNotificationPresentationOptions passed as a parameter.

So, you may want to start debugging in why, either the completionHandler is not being called, or the object containing the presentation options you are passing to it is incorrect or may have been released, etc.

Push notifications are not displaying when app is in foreground
 
 
Q