使用 APNS token 而非 FCM token 的 Firebase 云函数消息传递

标签 firebase apple-push-notifications firebase-cloud-messaging

我正在尝试设置一个 Firebase 云函数,该函数将触发带有有效负载的云消息传递。然而,该函数接收到的负载包含 Apple APNS token 而不是 FCM token ,我在 Firebase Admin SDK 中没有看到任何允许 APNS token 而不是 FCM 的方法。

这是否意味着我必须编写自己的 APNS Provider 而不能使用 FCM?!

最佳答案

Does that mean that I have to write my own APNS Provider and not use FCM?!


你可以这样做。我不明白这是多么令人震惊。为了使用 FCM,您需要使用 FCM token 。这就是服务的工作方式。
尽管如此,您还可以使用 InstanceID 服务器 API 到 create registration tokens with the APNs tokens :

Create registration tokens for APNs tokens

Using the Instance ID service's batchImport method, you can bulk import existing iOS APNs tokens to Google Cloud Messaging or Firebase Cloud Messaging, mapping them to valid registration tokens. Call the Instance ID service at this endpoint, providing a list of APNs tokens in the JSON body:

 https://iid.googleapis.com/iid/v1:batchImport

The response body contains an array of Instance ID registration tokens ready to be used for sending FCM or GCM messages to the corresponding APNs device token.

关于使用 APNS token 而非 FCM token 的 Firebase 云函数消息传递,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50344633/

相关文章:

ios - 使用 firebase 设置用户登录,但在运行应用程序时收到 Sigabrt

Firebase 和 google play 在不同的帐户上

javascript - 如何确定 Firestore 快照是否来自服务器?

angularjs - 如何通过 child 的属性查询Firebase?

grails - 生产iOS推送通知在本地发送,但不是从AWS Elastic beantalk发送

ios - 与 Apple Watch 配对后,远程通知声音还能在 iPhone 上播放吗?

ios - 使用 firebase 云消息传递中的 swift 无法将通知接收到 iPhone

ios - 使用新的 HTTP v1 API 时,Firebase 数据消息未传送到 iOS

android - FCM 后台同步失败 : AUTHENTICATION_FAILED

android - 具有多个主题的 Firebase API 调用