firebase react-native 推送通知适用于 iOS 发布版本,但不适用于通过 App Store 发布的应用程序

firebase react-native push notifications working for iOS release builds, but do not work in app released via App Store

我在 Google 播放 Android 上发布的版本中的推送通知按预期工作,抬头显示按预期显示。我还通过 Xcode 在发布版本中按预期工作推送通知。

问题:在通过 App Store 发布的 iOS 版本中,推送通知没有按预期出现。

我的包版本:

"firebase": "^4.8.1",
"firebase-admin": "^5.7.0",

没有错误或崩溃,只是没有显示推送通知。我也更新了 firebase 库,但不确定它有什么影响。

我没有使用证书,Firebase 建议的 APNs 身份验证密钥:

TL;DR

因此,总而言之,当使用 firebase-admin 并向后台的 ios 应用程序发送仅数据负载推送通知时,必须在选项参数中设置 contentAvailable: true通过:

const options = {
  priority: "high",
  contentAvailable: true,   // NOT content_available: true
}


admin.messaging().sendToDevice(tokens, notification, options)

...