【发布时间】:2020-04-08 05:37:29
【问题描述】:
我正在尝试每 1 分钟触发一次本地通知,即使在终止状态和后台状态下也是如此。但是,当时间在下午 06:00 之后,我的应用程序不应触发通知。下面是我的代码。
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 60,repeats: true)
//UNCalendarNotificationTrigger(dateMatching: dateComponents, repeats: true)
// Create the request
let uuidString = UUID().uuidString
let request = UNNotificationRequest(identifier: uuidString,
content: content, trigger: trigger)
// Schedule the request with the system.
let notificationCenter = UNUserNotificationCenter.current()
notificationCenter.add(request) { (error) in
if error != nil {
// Handle any errors.
}
}
}
【问题讨论】:
标签: ios swift uilocalnotification