firebase-cloud-messaging - FCM 是否支持 iOS 13 的新 apns-push-type
问题描述
我们目前有一个解决方案,可以将推送通知从 FCM 发送到 APNS,然后再发送到 iOS。由于 iOS13 的引入,APNS 现在在任何传入的有效负载中都需要 apns-push-type 来指定它是警报通知、后台通知还是任何其他类型。我想知道如何在发送到 FCM 的消息中添加此信息。
目前我们使用 pyFCM 向 FCM 发送消息。我们将此页面作为参考:https ://firebase.google.com/docs/cloud-messaging/http-server-ref
from pyfcm import FCMNotification
push_service = FCMNotification(api_key="XXXX")
registration_id = '<Token>'
data_message = {
"Score": "3*1",
"DeviceId": "XXXXXX",
}
# Background notification
result = push_service.notify_single_device(registration_id=registration_id,
content_available=True,
data_message=data_message)
# Alert notification
result = push_service.notify_single_device(registration_id=registration_id,
message_title='Sample title',
message_body='Sample body',
data_message=data_message,
)
这适用于现有的 iOS 应用程序。但是对于 iOS 13,我找不到任何地方来指定 apns-push-type 或 FCM 将转换为将发送到 APNS 的 apns-push-type 的任何等效字段。
我知道 iOS 13 相对较新,所以每个人仍在努力适应现有的解决方案。希望有人能给我一些见解,如何将 apns-push-type 放入我现有的解决方案中。谢谢。
解决方案
只需在要发送到 FCM 的请求标头中添加 'apns-push-type' = 'XXX'
推荐阅读
- azure-devops - 我需要哪些访问权限才能代表用户创建对 devops 工作项的订阅?
- jenkins - Jenkins 将任何非零退出代码视为错误
- powershell - PowerShell 将 .EXE 版本与 .MSI 版本进行比较
- java - 当条件数很大并且矩阵是对称且不定的时,是否有任何 ojAlgo 求解器?
- python - 不正确的令牌已通过 replit.com
- github - Github问题表单:根据下拉添加标签
- angular - Angular httpClient没有打电话
- nuxt.js - Nuxt 应用程序在使用 Flickity 时抛出错误消息
- json - 当对相似对象使用通用算法时,哪种继承/组合模式是合适的?
- javascript - 使用结构化数据标记 javascript