在 swift3 中看到 UILocalNotification 后如何取消或删除?

How to cancel or delete after seen UILocalNotification in swift3?

我在我的项目中使用了以下代码,但无法删除通知。

UIApplication.shared.cancelAllLocalNotifications()

如何解决这个问题?有人有这个问题吗?请帮助我。

一起
UIApplication.shared.cancelAllLocalNotifications()

也试试这个

UIApplication.shared.applicationIconBadgeNumber = 0

我认为它会从您的通知中心面板中删除所有通知。试试看。

As UIApplication.shared.cancelAllLocalNotifications() 只会取消所有已安排的本地通知的发送,不会删除通知。