This question already has an answer here:
UILocalNotification - repeatInterval reset (no repeat)

(1个答案)


4年前关闭。




在交换机内部,我有一个触发消息的触发器,可以重复自身。开关关闭时如何停止?
let notification = UILocalNotification()
notification.fireDate = NSDate(timeIntervalSinceNow: 5)
notification.repeatInterval = NSCalendarUnit.Minute
notification.alertBody = "Please Look at me"
notification.soundName = UILocalNotificationDefaultSoundName
notification.userInfo = ["CustomField1": "w00t"]
guard let settings = UIApplication.sharedApplication().currentUserNotificationSettings() else { return }

最佳答案

您可以使用取消所有本地通知

cancelAllLocalNotifications

或通过以下方式查看预定的通知列表
scheduledLocalNotifications

并取消该特定对象(通过指定通知的“userInfo”字段进行标记)。

关于ios - 如何停止来自应用程序的通知,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/36107662/

10-11 22:32
查看更多