Search code examples
iphoneiphone-4

how many days can a app live in background


I am actually doing some daily checks of the app assuming the app will be closed and opened daily. It works fine for 3.1 devices. My question is how many days can a app live in background on iPhone 4.0 OS.

If it lives for a long time what are the best ways to make daily schedules to contact my backend server ?


Solution

  • Why do you say it works fine for 3.1 devices? If you want the app to update when opened from the springboard like it does in 3.1 then you want to use applicationWillEnterForeground: in your app delegate to call the right code.

    If you must update periodically in the background then you can use setKeepAliveTimeout:handler: and beginBackgroundTaskWithExpirationHandler, but I don't know what the app store reviewers will think about a non-VOIP app using using it.