我使用in local表示repeatInterval,是否可以检索repeatInterval再次运行的时间?我需要这个来更新计数器“在触发通知之前剩下多少”。
答案 0 :(得分:1)
如果您定位iOS
10+,则应使用UNUserNotificationCenter
。
UNUserNotificationCenter
方法getPendingNotificationRequests(completionHandler:)将在待处理通知请求的完成处理程序列表中返回。
列表的每个元素都是UNNotificationRequest
对象,其中包含属性trigger
。
如果触发器为UNTimeIntervalNotificationTrigger
或UNCalendarNotificationTrigger
,则其方法nextTriggerDate()
将为您提供下次触发时的时间点。
它看起来像你在寻找什么。