![](/img/trans.png)
[英]UNUserNotificationCenter Swift - Local Notification Not Firing in specific cases
[英]UNUserNotificationCenter not clean notification of icon app in swift 3?
我有個問題。 我在我的應用中收到了一條通知。 我正在嘗試這個。 但是現在,我無法從圖標應用中刪除。
我運行以下代碼:
UNUserNotificationCenter.current().getPendingNotificationRequests(completionHandler: {requests -> () in
print("\(requests.count) requests -------")
for request in requests{
print(request.identifier)
}
UNUserNotificationCenter.current().removeAllPendingNotificationRequests()
})
UNUserNotificationCenter.current().getDeliveredNotifications(completionHandler: {deliveredNotifications -> () in
print("\(deliveredNotifications.count) Delivered notifications-------")
for notification in deliveredNotifications{
print(notification.request.identifier)
}
UNUserNotificationCenter.current().removeAllDeliveredNotifications()
})
跟蹤是這樣的:
0個請求------- 0個已發送的通知-------
在圖標應用程序中,我看到以下內容:
Yayo,您需要將徽章計數設置為0
才能從應用程序圖標中刪除徽章計數。 為了那個原因 -
UIApplication.shared.applicationIconBadgeNumber = 0
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.