I am getting bug reports from users that occasionally the AlarmKit alarms scheduled by my app are going off exactly at midnight.
In my app, users can set recurring alarms for sunrise/sunset etc. I implement this as fixed schedule alarms over the next 2-3 days with correct dates pre-computed at schedule time. I have a background task which is scheduled to run at noon every day to update the alarms for the next 2-3 days.
Are there any limitations to the fixed schedule which might be causing this unintended behavior of going off at midnight?
In my case, I was able to resolve this by making sure my app was not cancelling and scheduling too many alarms at every update. Assigning stable id's and then diffing the current set of alarms to the desired set of alarms and only performing the required operations fixed the issue. When this issue was happening at every update, I was cancelling all scheduled alarms and replacing them with new alarms. I was never able to log any errors but after these changes this problem went away.