Hello all,
I have an app that allows users to create a repeating event. Based on user-provided start date and repeat pattern (daily, weekly, monthly, etc.), the app schedules a repeating notification using UNUserNotificationCenter with a UNCalendarNotificationTrigger.
If the repeat pattern is daily, the user receives notifications each day at the specified time. This works perfectly.
But because UNCalendarNotificationTrigger uses a start date and matches components (in the case of daily repetition, it matches the timezone, hour, minute, and second), if the user enters a start date that is in the future, UNCalenderNotificationTrigger fires before the selected start date because all it does is match components.
Does anyone have ideas for a solution to how I could fix this issue? I was thinking maybe scheduling the scheduling of the notification for a day in advance of the event. I don't want to use a for loop to create multiple notifications because that it difficult to manage.
I have an app that allows users to create a repeating event. Based on user-provided start date and repeat pattern (daily, weekly, monthly, etc.), the app schedules a repeating notification using UNUserNotificationCenter with a UNCalendarNotificationTrigger.
If the repeat pattern is daily, the user receives notifications each day at the specified time. This works perfectly.
But because UNCalendarNotificationTrigger uses a start date and matches components (in the case of daily repetition, it matches the timezone, hour, minute, and second), if the user enters a start date that is in the future, UNCalenderNotificationTrigger fires before the selected start date because all it does is match components.
Does anyone have ideas for a solution to how I could fix this issue? I was thinking maybe scheduling the scheduling of the notification for a day in advance of the event. I don't want to use a for loop to create multiple notifications because that it difficult to manage.