Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> iOS

วิธีดู Notification ที่ Active ใน Status Bar บน iOS

ใช้ getDeliveredNotifications เพื่อดูรายการ Notifications ที่แสดงใน Notification Center อ่านรายละเอียด

ไม่สามารถดู Notifications ของแอปอื่นได้ (สิทธิส่วนตัว) แต่ดูของแอปตัวเองได้

Apple มี getDeliveredNotifications(completionHandler:) คืนรายการ Notifications ของแอปที่ยังแสดงอยู่

UNUserNotificationCenter.current().getDeliveredNotifications { (notifications) in
print(notifications)
}