当使用 Xcode 项目时
当使用 Swift Package Manager 清单时
选择 package 版本
0.0.5
main
在一个地方查看所有计划的本地通知
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:)
回调。更多信息请参阅: 处理通知和与通知相关的操作(参见“处理应用在前台运行时收到的通知”部分)
- 点击 File → Swift Packages → Add Package Dependency。
- 输入
http://github.com/nicephoton/ScheduledNotificationsViewController.git
。