arturovm
arturovm

Reputation: 1235

non-fixed repeatInterval in UILocalNotification

I've been cracking my head on this one for weeks now.

What happens if I set the repeatInterval property of a UILocalNotification to be a non-fixed interval? (by non-fixed I mean units such as NSWeekdayCalendarUnit and NSWeekdayOrdinalCalendarUnit).

So say I have UILocalNotification with its fireDate set to the Wednesday in the current week, and I set the repeatInterval to be NSWeekdayCalendarUnit. Will it repeat every Wednesday?

Is the same true for NSWeekdayOrdinalCalendarUnit? So if I have a notification with the fireDate set to be the 4th Wednesday of the month, and I set the repeatInterval to be NSWeekdayOrdinalCalendarUnit, will it repeat every 4th Wednesday of every month?

Thank you in advance.

Upvotes: 4

Views: 2133

Answers (1)

arturovm
arturovm

Reputation: 1235

OK, for the benefit of everyone, here's what I found:

  • Setting the repeat interval to NSWeekdayCalendarUnit doesn't work how I expected, instead, I suppose it looks for every occurrence of that weekday inside a week, and because there is only one, it then schedules the notification for the end of that week (the default is Saturday)

  • In a similar way, setting it to NSWeekdayOrdinalCalendarUnit creates a similar behavior, in that, seeing that there is no more occurrences of X ordinal of X day, it resorts to scheduling to the las ordinal for that weekday in a month.

Upvotes: 3

Related Questions