5

At first glance, this may look similar to many other questions on stack overflow, but I didn't find the solution for the issue I am facing. I am using xcode 8.3.2 and ios 10.3.2 and configured FCM to send push notifications. I am receiving push notifications in foreground, background and not running states so no problem from firebase end or certificates. I have set the delegate for UNUserNotificationCenter and FIRMessaging as well. I am testing the service by sending notification from firebase console. When I press the notification to launch the app, the method userNotificationCenter didReceive response method is getting called, but when the app is in foreground userNotificationCenter willPresent notification is not getting called when a notification arrives. I have tried enabling and disabling method swizzling as well. didn't help.

KENdi
  • 7,576
  • 2
  • 16
  • 31
RAM
  • 204
  • 4
  • 14
  • When the app is in foreground the notification will not show, you can receive and them present as local notification. See that is only possible in iOS 10+, in iOS 8.2 and 9 it doesn't work, one ideia is making a view to appear like the notification in n iOS 8.2 and 9 – José Neto May 19 '17 at 11:36
  • 1
    i don't need notification to appear. In fact i don't want that to happen. I just want to process the data sent through the notification. But willpresent notification method is not getting called. so i can't even read the data. – RAM May 19 '17 at 11:42
  • Did you try to get in this func: func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) – José Neto May 19 '17 at 11:53
  • i did. But this is also getting called when i open the app from notification not when the app is in foreground. – RAM May 19 '17 at 11:55
  • 1
    any answers for this? – sudeepdino008 Sep 17 '18 at 09:16

0 Answers0