Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16552

react native ios objective c, can't receive push notifications in foreground

$
0
0

I use react native push notification with firebase cloud messaging to handle receiving push.My problem is i can't receive the push in foreground.

My code is :

 // Receive displayed notifications for iOS 10 devices.// Handle incoming notification messages while app is in the foreground.- (void)userNotificationCenter:(UNUserNotificationCenter *)center       willPresentNotification:(UNNotification *)notification         withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler {  NSDictionary *userInfo = notification.request.content.userInfo;  // With swizzling disabled you must let Messaging know about the message, for Analytics  [[FIRMessaging messaging] appDidReceiveMessage:userInfo];  // Print message ID.  if (userInfo[kGCMMessageIDKey]) {    NSLog(@"Message ID: %@", userInfo[kGCMMessageIDKey]);  }  // Print full message.  NSLog(@"%@", userInfo);  // Change this to your preferred presentation option  completionHandler(UNNotificationPresentationOptionBadge | UNNotificationPresentationOptionAlert);}

Viewing all articles
Browse latest Browse all 16552

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>