• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

Apple 推送通知徽章编号

用户头像
it1352
帮助1

问题说明

我开发了服务器端应用程序,以在收到新通知后将徽章编号保持为递增或递减,并在看到通知后删除它工作正常.

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?

正确答案

#1

它会一直显示,直到您将其设置为零为止,您可以使用以下代码进行操作:

It will show until you set it to zero and you can do it with the following code:

    [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0]



在收到通知时设置徽章编号更为常见,在 application:didReceiveRemoteNotification:application:didFinishLaunchingWithOptions: 方法中 UIApplicationDelegate> 班级.



It is more common to set the badge number as you receive the notification, in either application:didReceiveRemoteNotification: or application:didFinishLaunchingWithOptions: methods of your UIApplicationDelegate class.

您可以在本地和推送通知中阅读更多相关信息编程指南

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /reply/detail/tanhcfgcic
系列文章
更多 icon
同类精品
更多 icon
继续加载