ios - iPhone 和桌面应用程序中带有角标(Badge)的 APNS

标签 ios swift apple-push-notifications badge

我在 iPhone桌面 上都有邮件应用程序。如果我读了来自desktop的邮件 然后,当我没有在 iPhone 上打开邮件时,iPhone 邮件应用程序的角标(Badge)计数会自动更新(角标(Badge)计数递减)。 。这意味着我的iPhone 邮件应用程序尚未启动。 APNS怎么样角标(Badge)计数在这些情况下有效吗?

最佳答案

您需要在有效负载中传递角标(Badge)计数器。请参阅以下代码。

{"aps":
    {"alert":"Notification Hub test notification2",
     "badge":20,
     "sound":"Default"}
}

请参阅此帖子了解更多信息: How to do badge increment on iOS push notification

Update badge with push notification while app in background

关于ios - iPhone 和桌面应用程序中带有角标(Badge)的 APNS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55414039/

相关文章:

启用声音的 JavaPNS 推送通知

android - 在 native react 中打开联系人应用程序

android - 在firebase,flutter中应该如何处理好友请求和邀请?

ios - 如何创建一个 UIButton 调整大小以适应其中的图像?

ios - 当我在 Xcode 的界面生成器中做某事时,幕后会发生什么?

ios - 如何使用 php 服务器在 IOS 中将 APN 作为服务器端

ios - 无法访问互联网后推送通知会怎样?

ios - 参数类型 'UITextField' 不符合预期类型 'Sequence'

iphone - Autolayout - 拉开 super View ?

swift - 如何在 SQLite FTS5 中突出显示前缀匹配