can't receive notification in ios : sending FcmTokenRefreshed with no listeners registered

1.2k Views Asked by At

i send notification with fire-base , in ios app i have this error : sending FcmTokenRefreshed with no listeners registered if app opened receive notification but when app closed not receive and show error .
excuse me for bad English!

"react": "16.4.1"

"react-native": "0.55.4"

"react-native-fcm": "^16.2.4",

"xcode 10.1"

1

There are 1 best solutions below

1
On

Make sure to put this lines in your

FILE : AppDelegate.m :

1 )

import "RNFirebaseNotifications.h"  
import "RNFirebaseMessaging.h"

2 ) add this line to the didFinishLaunchingWithOptions [RNFirebaseNotifications configure];

3 ) add methods

(void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
  [[RNFirebaseNotifications instance] didReceiveLocalNotification:notification];
}

 (void)application:(UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo
                                                       fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler{
  [[RNFirebaseNotifications instance] didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
}

  (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings {
  [[RNFirebaseMessaging instance] didRegisterUserNotificationSettings:notificationSettings];
}