【发布时间】:2017-11-03 19:33:51
【问题描述】:
使用来自UNUserNotificationCenter 的新本地通知。
我尝试删除带有一些标识符的通知:
UNUserNotificationCenter.current().removePendingNotificationRequests(withIdentifiers: identifiers)
并来自文档:
此方法异步执行,删除辅助线程上的未决通知请求。
完成处理程序不存在。那么我怎么知道它什么时候真正被删除呢?在继续之前,我需要确保该标识符不再存在。
我知道我可以使用下一个代码
notificationCenter.getPendingNotificationRequests { (requests) in
for request in requests {
}
}
但如果我在删除后立即运行此代码 - 它们仍然存在。但是经过一段时间和后来的代码,它们就消失了。尤其是当您即将达到 64 条通知的限制时,在添加新通知之前这一点很重要
【问题讨论】:
标签: ios swift3 ios10 unusernotificationcenter