相关疑难解决方法(0)

等到使用 removePendingNotificationRequests ios 10 swift 3 删除来自 UNUserNotificationCenter 的本地通知

使用来自UNUserNotificationCenter. 我尝试删除带有一些标识符的通知:

UNUserNotificationCenter.current().removePendingNotificationRequests(withIdentifiers: identifiers)
Run Code Online (Sandbox Code Playgroud)

并从文档:

此方法异步执行,删除辅助线程上挂起的通知请求。

完成处理程序不存在。那么我怎么知道它什么时候真的被删除了呢?在继续之前,我需要确保此标识符不再存在。

我知道我可以使用下一个代码

notificationCenter.getPendingNotificationRequests { (requests) in
        for request in requests {
         }
}
Run Code Online (Sandbox Code Playgroud)

但是,如果我在删除后立即运行此代码 - 它们仍然存在。但是一段时间后,在代码中它们消失了。当您即将达到 64 条通知的限制时,在添加新通知之前尤其重要

ios swift3 ios10 unusernotificationcenter

5
推荐指数
1
解决办法
1225
查看次数

标签 统计

ios ×1

ios10 ×1

swift3 ×1

unusernotificationcenter ×1