I'm working on an enterprise application, which is similar to contacts, calendar. I would like to sync my calendar and contact even when my application is in background. I'm good to use private API's also, as I'm not going to submit to the app store. Note here is, i wanted to make this work without jailbreaking the device.
Aalready a similar question posted here I'm creating this new thread since the already posted one has a solution suggested for Jailbreaked device.
If this is an enterprise app and you're not submitting to Apple then I would explore having your app identify itself as a VOIP app. Then you can set a keepAliveTimer and get get periodic processing time in the background to do what you need.
If you want to run continuously, another idea is to enable "audio" in Required Background modes in Info.plist and keep on looping a silent mp3 till you want to keep running.
I'm sharing the answer for my own question as this might help others
Steps:
1: Add "Required background modes" key in your application-info.plist and assign value as "App provides Voice over IP services" to its item.
2: In your appdelegate.m file, implement the "applicationDidEnterBackground:" method as below code snippet.
Here for example, i'm printing the counter variable in the given time interval Below is the Output Log message: