ScheduledNotificationsViewController 将所有待处理的本地通知集中在一个地方,并提供您所需的所有信息。点击通知会立即触发其传递,这使得这个小工具对于调试本地通知来说非常宝贵。
Medium 文章 请点击这里。
已安排 | 已发送 | 点击以触发 |
---|---|---|
import UIKit
import ScheduledNotificationsViewController
// ...somewhere in "Settings" screen:
#if DEBUG
let notificationsVC = ScheduledNotificationsViewController()
self.navigationController?.pushViewController(notificationsVC, animated: true)
#endif
问:我的已安排通知列表是空的
答:请确保您已在设备上授予您的应用通知权限。更多信息请参阅: 请求使用通知的权限
问:我点击列表中的通知,但没有任何显示
答:请确保您在 UNUserNotificationCenterDelegate
中使用 userNotificationCenter(_:willPresent:withCompletionHandler:)
回调。更多信息请参阅: 处理通知和与通知相关的操作(参见“处理应用在前台运行时收到的通知”部分)
http://github.com/nicephoton/ScheduledNotificationsViewController.git
。