Schedule an iOS app task to run in the background

I am writing an application for a client in which users will enter data during the day, and then at a certain moment of the night (for example, at midnight) user data for that day should be uploaded to the server.

Therefore, I need to plan a method to run in my application at midnight, even if the application is in the background. This method then synchronizes the collected data with the server and downloads any changes.

To achieve this, I assume that I need to configure the application to always run in the background (i.e. more than 10 minutes), and then plan the function to run after a certain time. I do this using performSelector: withDelay: :? Or do I need something more reliable because the application will be in the background?

Thanks guys!

+5
source share
2 answers

You can check out UILocalNotifications. You can schedule this event and then set the icon icon to let the user know that he has processed something (or not).

Information about these HERE

+2
source

I do not think that your application or what you are trying to do is qualified for Apple's requirements for a long background task. Check out the “Performing Long-Term Background Tasks” section of this document from Apple.

0
source

All Articles