[英]How to setup badge count firebase push notification in ios?
I have successfully setup my backend to send notification using "firebase-admin".我已成功设置后端以使用“firebase-admin”发送通知。 However, I am having trouble setting up the badge count for my ios.但是,我无法为我的 ios 设置徽章计数。 I am currently using react native and node.js typescript for backend.我目前正在使用 react native 和 node.js typescript 作为后端。
My backend admin when sending looks like this:发送时我的后端管理员如下所示:
const payload = {
notification: {
title: "title",
body: `body`,
//badge: 1 this throws an error
},
token: receiverFcmToken
};
try{
await admin.messaging().send(payload).then((response) => {
console.log("success);
});
} catch(err){
console.log(err);
}
Any help would be appreciated.任何帮助,将不胜感激。 Thanks谢谢
Your payload should look like this:您的有效负载应如下所示:
const payload = {
notification: {
title: "title",
body: `body`,
},
apns: {
payload: {
aps: {
badge: 1,
},
},
},
token: receiverFcmToken
};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.