iOS Enterprise app - How can I make sure my app runs in the background?

Viewed 854

First of all it's important to note that I'm developing an Enterprise App, so there is no need for App Store guidelines \ approvals considerations.

My goal is the following:

1) An iPhone app which the user should open only one time only. During this one time he will go through some sign up process.

2) Once step (1) has finished (either by app suspension or app close), the app should "wake up" every hour (more or less) and send the server some data regarding the user from the background (all is done with the user agreement of course).

Optional Solutions I tried:

I read very thoroughly Apple guidelines for running in background in https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html

I decided to go with 2 UIBackgroundModes:

  • location
  • fetch

1) For location I use:

If you leave the significant-change location service running and your iOS app is subsequently suspended or terminated, the service automatically wakes up your app when new location data arrives.

2) For background fetch I use

performFetchWithCompletionHandler()

and

UIApplication.sharedApplication().setMinimumBackgroundFetchInterval(UIApplicationBackgroundFetchIntervalMinimum);

For some reason the app doesn't run in background after 24 hours. Meaning the app never "wakes up" again even though according to Apple guidelines whenever significant location update occurs - it suppose to wake up.

What can I do in order to guarantee as much as possible that my app will run regularly in the background?

2 Answers
Related