解决方案代码:
let center = UNUserNotificationCenter.current()
print(center.getPendingNotificationRequests(completionHandler: { error in
// error handling here
}))
我的原帖:
我正在尝试通过 UNUserNotificationCenter 获取UIApplication.shared.scheduledLocalNotifications
已折旧的待处理通知列表。
这是我正在使用的代码:
let center = UNUserNotificationCenter.current()
print(UNUserNotificationCenter.getPendingNotificationRequests(center))
但是,这会打印“(功能)”。getPendingNotificationRequests 需要一个 UNUserNotificationCenter 参数,我想不出它还能是什么。
谢谢