Lifecycle of Apps Launched Directly into the Background

assume an app was launched directly into the background from the terminated/nonexistent state:

  1. is it possible to extend the time allowed to process in the background with initiating a background task?

  2. will iOS detect that an app has finished doing its business and terminate it before the expiration time claimed by backgroundTimeRemaining?

  3. can the app ever directly transition from this mode to foreground if the user taps on the app icon while the app is silently running in the background?

Replies

is it possible to extend the time allowed to process in the background with initiating a background task?

Yes, up to a fairly short limit. Use a UIApplication background task for this.

will iOS detect that an app has finished doing its business and terminate it before the expiration time claimed by backgroundTimeRemaining?

My general advice is that you ignore backgroundTimeRemaining. Rather:

  • Hold a UIApplication background task while you’re doing work and release it as soon as you’re done.

  • Implement an expiry handler.

For more hints and tips, see my UIApplication Background Task Notes post.

can the app ever directly transition from this mode to foreground if the user taps on the app icon while the app is silently running in the background?

Absolutely.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"