如何检查iOS状态栏中的哪些通知处于活动状态?
要获取状态栏托盘上活动的通知列表,我们将使用getdeliverednotifications,您可以在此处了解更多信息。
https://developer.apple.com/documentation/usernotifications/unusernotificationcenter
https://developer.apple.com/documentation/usernotifications/unusernotificationcenter/1649520-getdeliverednotifications
虽然知道我们无法从所有应用程序获取通知,因为这将违反隐私,但是我们可以获取应用程序的通知
苹果提供getDeliveredNotifications(completionHandler:)
它返回仍在通知中心显示的应用程序通知列表。
您可以根据需要编写以下代码。
UNUserNotificationCenter.current().getDeliveredNotifications { (notifications) in
print(notifications)
}热门推荐
10 广西考试祝福语结婚简短
11 猪年祝福语简短小孩
12 元旦祝福语送长辈简短
13 恭喜二宝祝福语简短
14 祝福语暖心话简短
15 国庆中秋祝福语简短兄弟
16 朋友订婚的祝福语简短
17 送弟弟中秋祝福语简短
18 爱生日祝福语简短独特