gpt4 book ai didi

firebase-cloud-messaging - FCM 是否支持 iOS 13 的新 apns-push-type

转载 作者:行者123 更新时间:2023-12-05 07:18:42 25 4
gpt4 key购买 nike

我们目前有一个解决方案,可以将推送通知从 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 的请求 header 中添加 'apns-push-type' = 'XXX'

关于firebase-cloud-messaging - FCM 是否支持 iOS 13 的新 apns-push-type,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58194041/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com