Launch / run iOS app periodically

I have an application that is running in the background. I would like to wake him up periodically: either at a given time of the day, or at every hour. This must be done without user intervention.

I believe that since the application is running in the background, the NSTimer will not work. How can I "wake up" my application on a periodic basis?

+3


source to share


2 answers


Of course, this is possible and very easy to implement.
This technique is called background sampling.
It works like this -
1) You ask the operating system to wake up / launch the application at a specific time.
2) The operating system decides and periodically runs your application and calls

-(void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler

      



3) You perform your tasks there, and you can also initiate a local user notification that new data is available.

here is a great article that covers your question

+5


source


You can enable push notifications; however, the user will need to select a notification.



0


source







All Articles