待处理通知我有下面这个函数:更新iOS中10
@objc func decrementBadges(){
let center = UNUserNotificationCenter.current()
center.getPendingNotificationRequests(completionHandler: { (notifications) in
print("count", notifications.count)
for notification in notifications{
//center.removePendingNotificationRequests(withIdentifiers: notification.title)
print(notification.content.badge)
print(notification.description)
}
})
}
我试图减小对所有悬而未决的通知徽章号码。这可能吗? notification.content.badge是只读的,我无法找出设置它的方法。
所有通知标志?你在谈论应用程序图标上的徽章是吗? –
是的,遍历所有待处理的通知并更新该通知触发时设置的徽章号码。 – ianhotep