w IOS 10, przede wszystkim roztwory amortyzuje
"cancelAllLocalNotifications() została zaniechana w iOS 10,0: Use UserNotifications Framework - [UNUserNotificationCenter removeAllPendingNotificationRequests]
użytkowania poniżej kodu zrezygnować powiadomienie i resetowanie Liczba znaczków
Dla systemu iOS 10, Swift 3.0
cancelAllLocalNotifications
przestarzałe z iOS 10.
@available(iOS, introduced: 4.0, deprecated: 10.0, message: "Use UserNotifications Framework's -[UNUserNotificationCenter removeAllPendingNotificationRequests]")
open func cancelAllLocalNotifications()
Trzeba będzie dodać tę instrukcję import,
import UserNotifications
Get centrum powiadomień. I wykonać operację jak poniżej
application.applicationIconBadgeNumber = 0 // For Clear Badge Counts
let center = UNUserNotificationCenter.current()
center.removeAllDeliveredNotifications() // To remove all delivered notifications
center.removeAllPendingNotificationRequests() // To remove all pending notifications which are not delivered yet but scheduled.
Jeśli chcesz usunąć jednego lub wielu konkretnych powiadomień, można to osiągnąć przez poniżej metody.
center.removeDeliveredNotifications(withIdentifiers: ["your notification identifier"])
Mam nadzieję, że pomoże .. !!
Użyj cancelAllLocalNotifications? To jest zdalne powiadomienie. Dzięki za komentarze. – Tedha
Ops Przepraszam, że pomyliłem się z powiadomieniami lokalnymi, ponieważ normalnie używam ich jednocześnie. – Icaro
A może to pomoże zbyt http://stackoverflow.com/questions/10971825/remove-remote-notifications-from-notification-center – Icaro