Can#39;t send push notifications using the server API(无法使用服务器 API 发送推送通知)
问题描述
我正在使用新的 Firebase 平台.我正在尝试获取我的应用服务器发送的推送通知并发送到我的 iPhone.
Im using the new Firebase platform. Am trying to get a push notification sent by my app server and delivered to my iPhone.
我的设置工作正常,我在网站上的 Firebase 通知区域手动发送消息,但是当我尝试通过 POST 将消息发送到 https://fcm.googleapis.com/fcm/send 我没有收到任何消息传送到设备.
I have the setup working where I manually send the message with the Firebase notifications area on the website, but when I try and send the message with a POST to https://fcm.googleapis.com/fcm/send I get no message being delivered to the device.
我正在发送以下内容(带有身份验证标头)
I'm sending the following (with auth headers)
{ "notification": {
"title": "Portugal vs. Denmark",
"text": "5 to 1"
},
"to" : "<registration token>"
}
我收到来自 POST 的 200 响应,正文如下:
I'm getting a 200 response from the POST with the following body:
{
"multicast_id": 5511974093763495964,
"success": 1,
"failure": 0,
"canonical_ids": 0,
"results": [
{
"message_id": "0:1463685441784359%3ad254b53ad254b5"
}
]
}
如果我尝试通过 Firebase 网站直接发送到此设备,它可以工作,但上面的表单帖子没有.不知道从这里去哪里!
If I try and send to this device directly through the Firebase website it works, but the above form post doesn't. No idea where to go from here!
推荐答案
在 iOS 上,priority
字段似乎是强制性的.
On iOS the priority
field seems mandatory.
{
"to": "cHPpZ_s14EA:APA91bG56znW...",
"priority": "high",
"notification" : {
"body" : "hello!",
"title": "afruz",
"sound": "default"
}
}
这篇关于无法使用服务器 API 发送推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:无法使用服务器 API 发送推送通知


- 在 Iphone SDK 的导航栏上添加多个按钮 2022-01-01
- 如何在 iPhone 模拟器中重置 NSUserDefaults 数据? 2022-01-01
- 使用自动布局向 UIScrollView 添加动态大小的视图 2022-01-01
- UITextView 内容插图 2022-01-01
- URL编码Swift iOS 2022-01-01
- 类似于 Mail.app 的 iPad 模态视图控制器? 2022-01-01
- SetOnItemSelectedListener上的微调程序错误 2022-01-01
- 网上有没有好的 UIScrollView 教程? 2022-01-01
- Xcode 7.3 中带有 UILabel 的 UIStackView 2022-01-01
- GPS状态的广播接收器? 2022-01-01