Apple 推送通知徽章编号
我开发了服务器端应用程序,以在收到新通知后将徽章编号维护为递增或递减,并在看到通知后删除它工作正常。
但是显示徽章时存在一些问题,实际情况是 - 在设备上收到新通知后,我单击取消按钮,然后徽章编号正确显示,但之后我将打开应用程序并关闭应用程序徽章将被删除。这意味着我不会向服务器发送我看到通知的请求,现在您可以将徽章减一。然后徽章也从应用程序图标中删除。
我的问题是,当我们打开应用程序时,徽章号码会自动从(应用程序)设备中删除吗?或者它会按原样显示,直到我们设置为零?
I have developed server side application to maintain the badge number as increment or decrement after receiving new notification and delete after seeing notification it works fine.
But there is some problem in showing the badge, the actual scenario is - After getting new notification on device, I am click on cancel button then badge number shows correctly but after that I will open the application and close the application badge will be removed. That means I am not sending request to the server that notification was seen by me and now you can decrement the badge by one. Then also badge removed from app icon.
My question is that when we open the application then badge number automatically removed from (application) device? or it will shows as it is until we set to zero?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
它将一直显示,直到您将其设置为零为止,您可以使用以下代码来完成此操作:
编辑:
更常见的做法是在收到通知时在
UIApplicationDelegate
的application:didReceiveRemoteNotification:
或application:didFinishLaunchingWithOptions:
方法中设置徽章编号> 类。您可以在本地和推送通知编程指南<中阅读更多相关信息< /a>
It will show until you set it to zero and you can do it with the following code:
EDIT:
It is more common to set the badge number as you receive the notification, in either
application:didReceiveRemoteNotification:
orapplication:didFinishLaunchingWithOptions:
methods of yourUIApplicationDelegate
class.You can read more about it in the Local and Push Notification Programming Guide
如果您想自动更改图标徽章,请使用以下代码。
我们还需要更改 php 文件。这样我们就可以自动获取图标徽章的变化
If you want to change the icon badge automatically use the following code.
We also need to change the php file. So we can get the change the icon badge automatically