gpt4 book ai didi

ios - 适用于 iOS 的 Firebase 云消息传递 : don't receive notifications from POST request (only from composer tool)

转载 作者:行者123 更新时间:2023-11-29 00:06:41 24 4
gpt4 key购买 nike

我使用其快速入门教程和 API 文档为 iOS 设置了 Firebase 云消息传递:https://firebase.google.com/docs/cloud-messaging/ios/first-message我从 Firebase Composer 工具向我的 iPhone 发送了消息,并且成功了。但我需要的下一步是接收通过常规 POST 请求发送的通知。我发现可以使用遗留协议(protocol):https://firebase.google.com/docs/cloud-messaging/auth-server#authorize_legacy_protocol_send_requests我尝试发送以下内容:

{ "data": {
"message": "This is a Firebase Cloud Messaging Topic Message!"
},
"to" : "myIphoneTokenHere"
}

通过 postman 使用我的 Firebase 项目的授权 key 并收到成功响应:

{
"multicast_id": 5644065455367933439,
"success": 1,
"failure": 0,
"canonical_ids": 0,
"results": [
{
"message_id": "0:1513338642327024%5529b926f9fd7ecd"
}
]
}

但是我的 iPhone 上没有任何通知,这与使用 Composer 工具不同。想知道我可以尝试解决这个问题,我该如何调试出错的地方?

最佳答案

通过将请求正文更改为解决了该问题:

{
"content_available": true,
"notification" : {
"body" : "This is a Firebase Cloud Messaging Topic Message!",
"title" : "FCM Message"}, "to" : "myIphoneTokenHere" }

关于ios - 适用于 iOS 的 Firebase 云消息传递 : don't receive notifications from POST request (only from composer tool),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47831883/

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