Is there any way to schedule local notification which fires at specific date and the repeats every minute? Example: user receive first notification at 8:00 AM and then 8:01, 8:02...
Asked
Active
Viewed 66 times
1 Answers
0
To schedule repeated notification you need date components in trigger initialization.
e.g.
let date = Date(timeIntervalSinceNow: 3600)
let triggerDaily = Calendar.current.dateComponents([.hour,.minute,.second], from: date)
let trigger = UNCalendarNotificationTrigger(dateMatching: triggerDaily, repeats: true)
trigger repeats notification daily
try to setup trigger using only .second
in date components
let date = Date(timeIntervalSinceNow: 3600)
let triggerDaily = Calendar.current.dateComponents([.second], from: date)
let trigger = UNCalendarNotificationTrigger(dateMatching: triggerDaily, repeats: true)

LLIAJLbHOu
- 1,313
- 12
- 17
-
This notification fires every minute since time when it was scheduled, but I need notification which repeats only after specific date. I am trying to build alarm clock, maybe you have idea how can i do that. – Volodymyr Hanas Apr 17 '20 at 11:03