0

Am trying to make push notifications (FCM) show up when app is in Foreground. Multiple manuals are referring to the below method. I can confirm it is being called when message is received, but notifications do not show up when app is in foreground (only background).

//To show a notification when the app is in foreground
-(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler
{
  NSLog(@"completion handler, which is called but does not work");
  completionHandler(UNNotificationPresentationOptionAlert + UNNotificationPresentationOptionSound);
}
Ross
  • 1,641
  • 3
  • 15
  • 16
  • Does this answer your question? [Get push notification while App in foreground iOS](https://stackoverflow.com/questions/14872088/get-push-notification-while-app-in-foreground-ios) – Prashant Tukadiya Jan 13 '23 at 14:34
  • 1
    could you pl try to replace + with | `UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionSound` – Prashant Tukadiya Jan 13 '23 at 14:36

0 Answers0