Before iOS 11 , when the app receive a notification while running in the foreground , the notification will not appear unless using a custom view to show it. Is the way we handle the received push notifications while app is running in the foreground changed in iOS 11?
Asked
Active
Viewed 457 times
1 Answers
1
Try this in Appdelegate class
func userNotificationCenter(_ center: UNUserNotificationCenter,
willPresent notification: UNNotification,
withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
completionHandler(.alert)
}
this is the delegate calls when app is in foreground and if you want to show alert as well then add .alert in completionHandler.
It is added in iOS 10 onwards
Further Ref : Silent pushes not delivered to the app on iOS 11

Community
- 1
- 1

Abhishek Thapliyal
- 3,497
- 6
- 30
- 69