且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

当应用程序未打开时收到推送通知时更新徽章编号

更新时间:2023-02-27 08:51:56

您需要为推送通知负载中的 badge 键设置一个值.从您的描述来看,似乎只有您的应用程序在更新徽章编号,而不是通知本身.

You need to set a value for the badge key in your push notification payload. From your description, it sounds like it is only your application which is updating the badge number, and not the notification itself.

参见 Notification Payload 本地和推送通知编程指南详情:

See The Notification Payload of the Local and Push Notification Programming Guide for details:

aps 字典的键和值

badge(编号):显示为应用程序图标徽章的编号.如果此属性不存在,则不会更改徽章.要移除徽章,请将此属性的值设置为 0.

badge (number): The number to display as the badge of the application icon. If this property is absent, the badge is not changed. To remove the badge, set the value of this property to 0.