'FCM NodeJS Push Notification not working on iOS

I looking for notification with firebase on iOS and Android. For App i use React Native and for backend i use NodeJS. I have already use FCM NodeJS Library, its successfully when i try to send notification to Android (emulator), but its not working when i send notification on iOS (emulator)

My nodeJS Code:

const FCM = require('fcm-node');
const fcm = new FCM(process.env.FIREBASE_SERVER_KEY);

exports.pushNotifNew = (req, res, next) => {
  var message = { 
    to: 'futyaqvqcEyqkcs4HNFXzH:APA91bFg', 
    
    notification: {
        title: 'Title of your push notification', 
        body: 'Body of your push notification' 
    },
    
    data: {  
        my_key: 'my value',
        my_another_key: 'my another value'
    }
  };

  fcm.send(message, function(err, response){
      if (err) {
          console.log("Something has gone wrong!");
      } else {
          console.log("Successfully sent with response: ", response);
      }
  });
}

Is there any required code or attributes in backend or React Native to send notification to iOS? But, when i use testfcm.com, its working for iOS. Thanks before.



Solution 1:[1]

do your notification body like below

{
    to: validDeviceRegistrationToken,
    data: { //some data object (optional)
        url: 'news',
        foo:'fooooooooooooo',
        bar:'bar bar bar'
    },
    priority: 'high',//imp
    content_available: true,
    notification: { //notification object
        title: 'HELLO', body: 'World!', sound : "default", badge: "1"
    }
};

notification object is imp for iOS

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sahil Kalaigar