ios - 判断是否触发了本地通知
问题描述
2个我找不到答案的问题:
1:如何判断是否触发了本地通知?
2:本地通知被触发后是否被删除?
解决方案
您不应该使用 UILocalNotification。现代方式是UNNotification。
您可以检查 UNUserNotificationCenter 的内容。称呼
getPendingNotificationRequests(completionHandler:)
的
getDeliveredNotifications(completionHandler:)
已发送但尚未从通知中心删除的通知(历史记录)在第二组中。
推荐阅读
- amazon-web-services - 更新 CloudFormation 堆栈时,存储在堆栈中的任何代码或数据会发生什么情况?
- javascript - 开玩笑测试,在第一次调用时调用实际实现,模拟其余部分
- javascript - 如果特定页面结构上的文本为空,则隐藏按钮
- arrays - 使用段树查找范围内第一个和最后一个元素的乘积之和,第二个和倒数第二个等等
- ibm-cloud - IBM Watson Assistant:如何从选项响应中设置上下文变量?
- azure - 有没有一种方法可以在用户单击创建之前通过 ARM 模板为用户创建存储帐户?
- javascript - JS 返回语法看起来很奇怪
- angular - 覆盖 routerLink 和 router.navigate
- python - How would I check for and manipulate matching value within all rows and columns of 2d list?
- javascript - How to use slice method in data-table, vue