Search code examples
swiftscheduled-tasksswift4uilocalnotification

Re-scheduling local notifications on a daily basis


I'm working on an application notifying Muslims at prayer time. Every day, five different notifications need to be set, notifying the users it's time to pray.

I was able to schedule notifications for one day, but how can I set them every day again? The 5 times need to be changed every day without user interaction or having to open the app.

Is there some kind of callback when the last notification fires, so I can setup notifications for the next day?


Solution

  • One way is to schedule notifications for a week (5*7) if you can get their times correctly , on the basis of that the user may open your app at least once/week

    Other way is to make use of background fetch capability where IOS wakes your app to run at any time On the assumption that you re-schedule them for a week from the launch time