Search code examples
iosiphoneterminationapplication-lifecyclebackground-foreground

Why does my iphone app not receive background fetch events after being terminated?


I've built a small ios app which perform periodic updates. I'm registering my app for background fetches with a callback handler. When app goes background I'm continue to receive callbacks over the time (every 20-30 minutes, event days later).

Once my app is terminated - the callback handler will be not executed any more.

Is it excepted behavior? I failed to find any mentions about activation from terminated state in Apple documentation on this.

ps: activation from the terminated state is crucial for my app. The approach of the activation could be any, except of user interaction.


Solution

  • It seems that if an app is terminated it will be awaken neither by background fetch nor push notification. No official documentation on this though.

    Also keep in mind that if you kill your app from the app switcher (i.e. swiping up to kill the app) then the OS will never relaunch the app regardless of push notification or background fetch. In this case the user has to manually relaunch the app once and then from that point forward the background activities will be invoked.

    Source here