我想显示一个 UILocalNotification
,但它的有效期只有 24 小时。 24 小时结束后,我希望通知“过期”;也就是说:用户无法再看到过时的通知。我怎样才能做到这一点?
最佳答案
要取消已发送的通知,请使用
UNUserNotificationCenter.current().removeDeliveredNotifications(withIdentifiers: ["myidentifier"])
或
UNUserNotificationCenter.current().removeAllDeliveredNotifications()
关于ios - 如何设置 UILocalNotification 的过期时间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7957502/