简体   繁体   English

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

[英]How to cancel or delete after seen UILocalNotification in swift3?

I used the following code in my project, but can't delete notification. 我在项目中使用了以下代码,但无法删除通知。

UIApplication.shared.cancelAllLocalNotifications()

How to solve this problem? 如何解决这个问题呢? Have anyone this problem? 有人有这个问题吗? Please help me. 请帮我。

Along with 随着

UIApplication.shared.cancelAllLocalNotifications()

Try this also 也尝试一下

UIApplication.shared.applicationIconBadgeNumber = 0

I think it will delete all notifications from your notification center panel. 我认为它将从您的通知中心面板中删除所有通知。 Try that out. 试试看。

As UIApplication.shared.cancelAllLocalNotifications() only cancels the delivery of all scheduled local notifications and doesn't delete the notification. 由于UIApplication.shared.cancelAllLocalNotifications()仅取消所有计划的本地通知的传递,而不删除通知。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM