【问题标题】:Cordova Push notifitication badge not displaying on app icon iOSCordova Push 通知徽章未显示在应用程序图标 iOS 上
【发布时间】:2017-03-08 09:38:17
【问题描述】:

我正在使用cordova push plugin 收到通知和我需要的所有数据,但我也想根据未读通知或我正在计算推送通知的数量设置徽章,但我不知道为什么我我没有将此计数作为 iOS 设备应用程序图标的徽章

这是我进入推送通知成功功能的json格式

{
    "count":"1",
    "sound":"default",
    "additionalData":{
        "foreground":true,
        "product_id":"19",
        "user_id":"2",
        "coldstart":false,
        "notificationstatus":"like"
    },
    "message":"Username likes your product"
}

声音和信息都很完美,但不算数。

有什么建议吗?

【问题讨论】:

标签: ios cordova push-notification


【解决方案1】:

您收到的内容没问题,但一键错误。密钥count 应该是badge。这是我认为的问题。尝试更改密钥并回复结果。

参考 - https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/TheNotificationPayload.html

【讨论】:

  • 我们将badge 关键字传递到aps,但它会自动将badge 转换为count 到响应中
【解决方案2】:

我注意到,响应中有一个字符串值count,这是错误的。

计数值必须是integer

希望这对其他人也有帮助。

【讨论】:

  • 欢迎@KirankumarDafda。很高兴为您提供帮助。
猜你喜欢
  • 1970-01-01
  • 2020-08-13
  • 2019-04-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-09-10
  • 2019-05-08
  • 1970-01-01
相关资源
最近更新 更多