aes*_*abs 9 ios swift3 ios10 unusernotificationcenter
解决方案代码
let center = UNUserNotificationCenter.current()
print(center.getPendingNotificationRequests(completionHandler: { error in
// error handling here
}))
Run Code Online (Sandbox Code Playgroud)
我的原帖:
我正在尝试通过UNUserNotificationCenter获取待处理通知的列表UIApplication.shared.scheduledLocalNotifications.
这是我正在使用的代码:
let center = UNUserNotificationCenter.current()
print(UNUserNotificationCenter.getPendingNotificationRequests(center))
Run Code Online (Sandbox Code Playgroud)
但是这会打印"(功能)".getPendingNotificationRequests需要一个UNUserNotificationCenter参数,我想不出它可能是什么.
谢谢
Jer*_*rry 28
该getPendingNotificationRequests调用将一组请求传递给完成闭包.尝试这样的事情:
let center = UNUserNotificationCenter.current()
center.getPendingNotificationRequests(completionHandler: { requests in
for request in requests {
print(request)
}
})
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8397 次 |
| 最近记录: |