在IOS10上使用UNUserNotification进行本地通知时如何设置徽章

时间:2017-09-07 20:31:03

标签: ios10 unusernotificationcenter

我正在使用UNUserNotification将重复的本地通知推送给用户。我正在尝试在应用上设置徽章编号以指示错过的通知。 我搜索了这个论坛并找到了 iPhone: Incrementing the application badge through a local notification

这表示不可能重复发生本地通知。该帖子已有几年历史了,他们正在使用UILocal通知。

对于UNUserNotification仍然如此吗?有没有办法设置徽章数?

1 个答案:

答案 0 :(得分:0)

设置badge对象的UNMutableNotificationContent属性。

let notificationContent = UNMutableNotificationContent()
notificationContent.badge = 3

来自http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPUT.html#RESTObjectPUT-responses-examples

  

<强>徽章

     

要显示为应用的图标徽章的数字。