【问题标题】:Firebase Messaging from Node Admin for iOS来自 iOS 节点管理员的 Firebase 消息传递
【发布时间】:2018-11-02 04:43:43
【问题描述】:

我正在尝试从 firebase 向 iOS 设备发送推送通知,但没有成功。以下是我尝试的有效载荷:

var message = {
  notification: {
    title: '$GOOG up 1.43% on the day',
    body: '$GOOG gained 11.80 points to close at 835.67, up 1.43% on the day.',
  },
  apns: {
    headers: {
      "apns-priority": '10'
    },
    payload: {
      aps: {
        alert: {
          title: '$GOOG up 1.43% on the day',
          body: '$GOOG gained 11.80 points to close at 835.67, up 1.43% on the day.',
        },
        "content-available": true
      }
    }
  },
  token: "adacxxxxxx 152 string"
};

当我尝试触发fbAdmin.messaging().send(message) 时,我收到{"code":"messaging/internal-error","message":"Internal error encountered."}

我有另一种适用于 Android 的格式,它运行良好。因此,我试图了解为什么 iOS 无法正常工作。感谢您提供任何建议或帮助,因为我已经为此花费了几天时间。

【问题讨论】:

  • 你在使用哪个库?
  • 我在 Nodejs 中使用"firebase-admin": "^6.1.0",
  • @DevsiOdedra 当我尝试从 fcm API 发送通知时,我收到原始错误消息:“InvalidAPNsCredentials”并通过更正 firebase 中的配置来解决它。

标签: ios firebase push-notification firebase-cloud-messaging firebase-admin


【解决方案1】:

通过尝试跟随,我已经成功地做到了这一点。

How can I send a Firebase Cloud Messaging notification without use the Firebase Console?

在我尝试调用 fcm api 后,我收到错误“InvalidAPNsCredentials”。然后我意识到我的 APN Auth Key 有问题。然后,我不得不重新下载 APN 身份验证密钥,更正团队 ID 并再次运行应用程序,现在它可以工作了!

【讨论】:

    猜你喜欢
    • 2017-09-28
    • 2021-08-06
    • 2017-05-05
    • 2020-10-21
    • 2019-07-12
    • 2020-07-10
    • 1970-01-01
    • 2017-07-04
    • 2017-04-01
    相关资源
    最近更新 更多