我正在使用 Flutter 和 Firebase 编写一个跨平台应用程序。我一直致力于发送通知,它在 Android 上完美运行。我通过 firebase 管理功能 sdk 发送消息,没有任何问题。该请求如下所示:
const payload = {
notification: {
title: title,
body: body,
},
}
return admin.messaging().sendToDevice(tokens, payload, {
mutableContent: true,
contentAvailable: true,
apnsPushType: "background",
})
但是当我尝试向 iOS 设备发送消息时,我从 shell 收到以下错误:
"error": {
"errorInfo": {
"code": "messaging/third-party-auth-error",
"message": "A message targeted to an iOS device could not be sent
the required APNs SSL certificate was not uploaded or
has expired. Check the validity of your development and
production certificates."
},
"codePrefix": "messaging"
}
我的印象是,由于我使用的是苹果开发者控制台中生成的 APNs 密钥,因此我不需要任何类型的 SSL 证书。我的密钥已上传到 Firebase 控制台,并且 iOS 设备已成功报告其设备令牌,因此我不确定为什么无法收到消息。
我尝试过从 CLI 以及 FCM 控制台在线发送消息。两者都失败了。
我还启用了推送通知和后台模式以及后台获取和远程通知。
任何帮助或建议将不胜感激。