Ignore Push Notifications When IOS App Is In The Foreground

I have a fairly large iOS project. When the app receives a notifications while in the foreground, the notification is displayed in something that looks like an AlertView. I want to get rid of it. I have no idea if this is something I programmed myself a long time ago, or if one of the frameworks in the project (Parse, Onesignal, FBSDK) is doing this. My question is, how can I find out where that alert view is coming from, so I can remove that code. I have not implemented the willPresentNotification method anywhere (I have searched through the entire project). I do have a didReceiveRemoteNotification method, and even though that should only be called when a notification is tapped, I have tried commenting it out. I have also searched through the entire project for UIAlertView and UIAlertController, to no avail.



OneSignal SDK automatically uses the new UserNotifications Framework, when iOS10 is detected on device.

In this case, the AppDelegate method didReceiveRemoteNotification method not get called, instead methods in UNUserNotificationCenterDelegate get invoked, which is captured by SDK to record clicks/views.

OneSignal use callback to handle received Notification.

  • OSHandleNotificationReceivedBlock: Called when the app receives a notification while in focus only

  • OSHandleNotificationActionBlock: Called when the user opens or taps an action on a notification.

  • OSNotificationOpenedResult: The information returned from a notification the user received.

You can directly implement UNUserNotificationCenterDelegate methods to handling notification-related interactions in your app.