我一次发送1000条通知,但所有通知均未发送到设备并出现此错误:
“错误”:{“代码”:“消息/注册令牌未注册”,“消息”:“ 提供的注册令牌未注册。先前有效 可以出于多种原因取消注册令牌。看到 错误文档以获取更多详细信息。
function sendPushNotification(title, token) {
var payload = {
notification: {
title: title,
body: title,
}
};
firebase.messaging().sendToDevice(token, payload)
.then((response) => {
console.log('Successfully sent message:', response);
})
.catch((error) => {
console.log('Error sending message:', error);
});
}