这是我在代码中使用的示例用法:
func notificationRequestsForTimer() -> [UNNotificationRequest] {
let content = UNMutableNotificationContent()
content.title = Options.shared.currentTimeInSeconds.descriptiveTime
content.body = "go and go"
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 60, repeats: true)
let request = UNNotificationRequest(identifier: TimerNotificationIdentifier, content: content, trigger: trigger)
return [request]
}
但是每60秒我就会获得标题:0', 0', 0' ...
而不是0', 1', 2', 3'
。
是否可以在即将出现通知时安排通知并设置标题?