【发布时间】:2020-08-19 16:52:15
【问题描述】:
当我尝试在 android 上发送通知时代码工作正常,但它不适用于 IOS 通知。得到以下错误:
{
"results": [
{
"error": {
"code": "messaging/internal-error",
"message": "An internal error has occurred. Please retry the request."
}
}
],
"canonicalRegistrationTokenCount": 0,
"failureCount": 1,
"successCount": 0,
"multicastId": 8118740071861272000
}
这是我的代码示例,请查看并帮助我解决问题。 此外,当我尝试从云消息控制台发送通知时,我会收到通知。
return await admin.messaging()
.sendToDevice(deviceToken, {
data: {
title: 'Test Fcm',
body: 'tesing fmc body',
content_available: 'true',
priority: 'high',
action_type: 'TEST'
},
notification: {
title: 'Test Fcm',
body: 'tesing fmc body',
content_available: 'true',
priority: 'high'
}
}
, {
priority: "high",
timeToLive: 60 * 60 * 24,
contentAvailable:true,
}).catch(err => {
console.log(err);
})
【问题讨论】:
-
您是否将 APNS 身份验证密钥上传到 Firebase 控制台?确保您已关注Configure APNS with FCM guide,并且没有任何问题。
-
是的,我已经上传了 APNS 身份验证密钥。它工作正常,突然抛出这个错误。
标签: javascript firebase firebase-cloud-messaging firebase-admin