I've been trying to schedule a UILocalNotification
on IOS at a specific timezone irrespective of where the user is currently location. The three scenarios I need to cover are
- being able to show a one-off notification at the the specified time and timezone
- show a daily notification at the specified time and timezone
- show a weekly notification on the specified day of the week (i.e. Sunday, Monday, etc) at the specified time and timezone
I tried tackling the first scenario but scheduling a notification to appear two minutes later with the timezone set to Pacific/Auckland. For background I'm based in Sydney and Auckland is two hours ahead. So suppose the current date and time in Sydney is 4th February 2020 8:00PM, I would parse a string using NSDateFormatter
that was "2020-04-02T22:02" and specify the timezone for the formatter as Pacific/Auckland too. That date is then passed to the UILocalNotification
's fireDate
property and the timeZone
property is also specified. I can see that it is the correct time in UTC. However, I'm finding that the notification doesn't fire two minutes later. Am I missing something or is there a bug/limitation with regards to what can be done using the old UILocalNotification
APIs? I find that if I schedule a notification that is one minute into the pass but in Auckland time that it fires immediately.