Answer the question
In order to leave comments, you need to log in
How to periodically check the base and send User Notification in iOS 13?
In the application, the user adds various objects for which two key dates are set. On each of these dates, you need to send a notification, but the second accuracy is not important.
I tried to start a BackgroundTask with a periodic check of the database and sending a notification. But the time of calling the task depends, apparently, on the cycles of the satellite of Saturn. It is all called once a month, if you're lucky.
There is an idea to do it through calendar notifications, but I'm not sure if this will work exactly and what the side effects will be. Each time you edit an object, you will need to demolish notifications and set new ones.
Actually, the question is: what's the best way to do what I want if I don't want to reinvent the wheel?
Answer the question
In order to leave comments, you need to log in
After closing the application , in the applicationDidEnterBackground method iterate through the elements in the database and set local push notifications. Here you can also update the badge, if it is used.
Remember about the limit of 64 pushes , if you need more - your backend.
It's not worth waking up via BackgroundTask for notifications)
For the Background mode, there is a certain list of possible tasks, and yours is unlikely to fit, so most likely it just pauses.
Local calendar notifications are great for this and will fire exactly the way you want.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question