使用API​​时,Firebase API不会发送推送通知

我正在从Parse迁移到Firebase,并面临我们的ios应用程序出现问题。 Firebase API不会将推送通知发送到ios应用程序。 这就是即时通讯发送到https://fcm.googleapis.com/fcm/send

{ "to: "<registration token>", "priority": "high", "data": { "customId": "<my custom id>", "badge": 1, "sound": "cheering.caf", "alert": "New data is available" } } 

而服务器正在成功返回

 { "multicast_id":6917019914327105115, "success":1, "failure":0, "canonical_ids":0, "results":[{"message_id":"0:1468961966677585%f0f84693f9fd7ecd"}] } 

但推动并没有实现。 如果我使用Firebase信息中心发送推送,即使直接使用令牌,推送也会发送。

我看到另一个开发人员在另一个Stackoverflow问题中抱怨无法使用服务器API发送推送通知

我尝试了join“优先级”的解决scheme:“高” ,但没有解决问题。 但它给了我一个线索:他们也在使用dev / sandbox推送证书。

我的怀疑是仪表板可以使用ios开发证书,但API不能。 这个问题只发生在iOS设备上,因为android应用程序正在通过API推送。

任何人都可以使用API​​和开发证书发送推送?

我已经与Firebase支持部门联系,并能够找出问题所在

我的推送有效负载丢失了一个通知对象

 { "to": "<registration token>", "priority": "high", "notification": { "title": "Your Title", "text": "Your Text" } "data": { "customId": "<my custom id>", "badge": 1, "sound": "cheering.caf", "alert": "New data is available" } } 

我希望能帮助别人

使用Firebase API发送到https://fcm.googleapis.com/fcm/send的对象应如下所示&#xFF1A;

 { "notification":{ "title":"Notification title", //Any value "body":"Notification body", //Any value "sound":"default", //If you want notification sound "click_action":"<activity_name>", //Must be present for Android "icon":"fcm_push_icon" //White icon Android resource }, "data":{ "param1":"value1", //Any data to be retrieved in the notification callback "param2":"value2" }, "to":"/topics/topicExample", //Topic or single device "priority":"high", //If not set, notification won't be delivered on completely closed iOS app "restricted_package_name":"" //Optional. Set for application filtering } 

如果您的问题已经解决,请不要忘记标记为这样。