使用 APNS 令牌而不是 FCM 令牌的 Firebase 云函数消息传递 [英] Firebase Cloud Function Messaging with APNS Token rather than FCM Token

查看:33
本文介绍了使用 APNS 令牌而不是 FCM 令牌的 Firebase 云函数消息传递的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am trying to setup a Firebase Cloud Function that will trigger a Cloud Messaging with Payload. The received load by the function however contains Apple APNS Tokens rather than FCM Tokens and I don't see any methods in Firebase Admin SDK allowing APNS Token rather than FCM.

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

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

推荐答案

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

你可以这样做.我不明白这是多么令人震惊.为了使用 FCM,您需要使用 FCM 令牌.这就是服务的运作方式.

You could do that. I don't see how this is a shock. In order to use FCM, you need to use FCM tokens. It's just how a service works.

话虽如此,您还可以使用 InstanceID Server API 创建使用 APNs 令牌注册令牌:

With all that said, you could also use the InstanceID Server API to create registration tokens with the APNs tokens:

为 APNs 令牌创建注册令牌

使用 Instance ID 服务的 batchImport 方法,您可以将现有的 iOS APNs 令牌批量导入 Google Cloud Messaging 或 Firebase Cloud Messaging,将它们映射到有效的注册令牌.在此端点调用 Instance ID 服务,在 JSON 正文中提供 APNs 令牌列表:

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

响应正文包含一组实例 ID 注册令牌,可用于将 FCM 或 GCM 消息发送到相应的 APNs 设备令牌.

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 令牌而不是 FCM 令牌的 Firebase 云函数消息传递的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆