【问题标题】:Send push notification firebase by postman通过邮递员发送推送通知firebase
【发布时间】:2017-07-03 21:05:07
【问题描述】:

我使用 postman 发出 HTTP 请求以向主题发送推送通知,我使用了以下正文信息:

{
  "to" : "/topics/mahdi",
  "priority" : "high",
  "notification" : {
    "body" : "This is a Firebase Cloud Messaging Topic Message!",
    "title" : "FCM Message2"
  }
}

当然我把授权key放在header中,请求成功,得到:

{"message_id":5081280333669625878}

但我的 iOS 设备上没有收到通知,请问错误在哪里?

【问题讨论】:

标签: ios push-notification postman


【解决方案1】:

确保你有

编辑:根据https://developer.apple.com/library/content/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html,要使其在后台运行,您还必须在消息中设置以下内容:

"content-available":"1"

【讨论】:

  • 我做了所有的建议,但仍然没有收到任何通知
  • 即使您打开了应用程序?使用 Firebase AppDelegate 方法,您应该能够在控制台日志中看到通知。
  • 最后,我收到了通知,但是当应用程序在前台时仍然看不到它,我只是在后台看到它
  • 这是因为您必须在通知中返回的 JSON 中添加标签“content-available”:“1”。来源:developer.apple.com/library/content/documentation/iPhone/…
猜你喜欢
  • 2021-09-04
  • 1970-01-01
  • 2019-01-09
  • 2019-03-18
  • 1970-01-01
  • 2020-12-24
  • 1970-01-01
  • 2016-04-24
  • 1970-01-01
相关资源
最近更新 更多