I am trying to get push notifications working for iOS applications for a nodeJS server. I have been able to configure it correctly for android using FCM tokens that are being sent to me. But I am unable to do the same for iOS. I tried to google online but the resources are fairly old and my iOS teammate said that he has configured everything on his end correctly. More so, after logging the output of the firebase admin package on nodeJS, I am getting a successful message ID as well. Any suggestions as to what can be done. I am attaching the nodeJS code as well for reference.
var data = {
notificationPriority: 'high',
notificationTTL: 3600
};
const fireadmin = require('firebase-admin');
fireadmin.initializeApp(
{
credential: fireadmin.credential.cert(keys.serviceAccount),
databaseURL: keys.databaseURL
}
);
var options = {
priority: data.notificationPriority,
timeToLive: data.notificationTTL
};
var payload = {
data: {
title: 'Test',
message: 'Message'
},
}
RegId.findOne({ userID: mongoose.Types.ObjectId(userID) }).then(tokenData => {
fireadmin.messaging().sendToDevice(tokenData.registrationToken, payload, options).catch(err => console.log(err))
}).catch(err => console.log(err))