Scheduling a task on iOS

57 views Asked by At

In my application I would like to schedule a task that will occur daily regardless of the app's state - meaning that I want this task to perform even if the app is in terminated state.

I'm aware that I can send push notification at the desired time to perform the task, but I don't want to implement the server side solution unless there're no other options.

When looking at Background Fetch I see that the system doesn't let me schedule the time of the task meaning it it could occur whenever the system decides it's the best time.

When looking at Background Task I see that that the tasks will executed only when the app is still in the background and not terminated. If the app goes to the terminated state then all the tasks are stopped.

My question is - is it possible to schedule a task that will run daily and indefinitely (or as much close to it as possible) regardless the app state?

1

There are 1 answers

3
Caleb On

I'm aware that I can send push notification at the desired time to perform the task, but I don't want to implement the server side solution unless there're no other options.

If a push notification would work for what you want to do, a local notification should be just as good, without the need for a server.

When looking at Background Task I see that that the tasks will executed only when the app is still in the background and not terminated. If the app goes to the terminated state then all the tasks are stopped.

As a user, I don't love the idea of an app that I've killed somehow continuing to run. What's the need for that? Most of the time when people ask about periodic tasks, it's because they want to receive or send data for some reason. Do you really want your users to have to delete your app in order to stop it from connecting?