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

get InvalidRegistration when send notifications with POST MAN using firebase in react native IOS app [duplicate]

$
0
0

I'm trying to send notification with post man to my react native IOS app .

In post man i send POST request :

Headers : 
Content-Type: application/json
Authorization: key=XXXXXXX ( i put firebase cloud messaging server key)

Body:
  // to   i put the device token

{
"to": "xxxx",
"data": {
    "message" : "lorem"
}

}

in my AppDelegate.m

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  [FIRApp configure];
// [START set_messaging_delegate]
  [FIRMessaging messaging].delegate = self;
  // [END set_messaging_delegate]

  // Register for remote notifications. This shows a permission dialog on first run, to

  // [START register_for_notifications]
  if ([UNUserNotificationCenter class] != nil) {

          // ...
        }];
  } else {
     // ..
  }

  [application registerForRemoteNotifications];
  // [END register_for_notifications]

  return YES;
}

and then i added other functions like the documentations of firebase IOS :

   // [START refresh_token]
- (void)messaging:(FIRMessaging *)messaging didReceiveRegistrationToken:(NSString *)fcmToken {

}
// [END refresh_token]



// Required to register for notifications
- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings
{
  [RNCPushNotificationIOS didRegisterUserNotificationSettings:notificationSettings];
}
// Required for the register event.
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
  [RNCPushNotificationIOS didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}

//
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
  ... 
}
// [END receive_message]

Actually i receive this response :

{
    "multicast_id": 1804810573619574964,
    "success": 0,
    "failure": 1,
    "canonical_ids": 0,
    "results": [
        {
            "error": "InvalidRegistration"
        }
    ]
}

and i don't get any notification in my device


Viewing all articles
Browse latest Browse all 16750

Trending Articles



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