我想知道如何在ios(Swift(中触发连续的本地通知,我在for循环中运行本地通知代码,但当我终止应用程序时,它不会执行完整的代码。
尝试以下操作:
let content = UNMutableNotificationContent()
content.title = "Hello"
content.body = "World"
content.badge = 1
content.sound = UNNotificationSound.default
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 60, repeats: true)
let request = UNNotificationRequest(identifier: "", content: content, trigger: trigger)
UNUserNotificationCenter.current().add(request, withCompletionHandler: nil)