Background fetch after app is force-quit

Hello!

Can someone please confirm whether or not an app will trigger background fetch after it has been force-quit by the user?

Currently my app works performs background fetches correctly when it has been backgrounded, but after force-quitting the app it stops fetching.

Specifically I am referring to scheduled background fetches, not fetches initiated by notifications - although I am interested to know if that would be an alternative.

I've tried searching online and there's a lot of confusing and contradictory information about this - including old Apple documentation that explicitly says it will not launch, however that documentation has since been removed. The new documentation does not explicitly mention the force-quit scenario.

Can anyone please confirm?

Thanks!

Replies

Can someone please confirm whether or not an app will trigger
background fetch after it has been force-quit by the user?

It will not. The system interprets this gesture (removing your app from the multitasking UI) as a strong indication that the user doesn’t want your app running. The system will not give the app background fetch time until after the user manually launches the app again.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Thank you for the quick response!

Does that mean there is no way for any background activity to occur in the app after the user has force closed the app?
Both fetch time and background/silent notifications (using "content-available") won't work?

(It appears that when the device is restarted that the "has been force closed" flag gets reset for apps - is that correct too?)
I'm facing the same problem as you mentioned @brucefromfortitude valley.
Hope the system doesn't allow us to do such background tasks when the user forcefully kills the app.

Regarding silent notifications, using content-available, it might work I reckon. I tried achieving it, received notifs even when the app is in killed (quit) state, with 'content-available'.

Both fetch time and background/silent notifications (using
content-available) won't work?

Correct.

Does that mean there is no way for any background activity to occur in
the app after the user has force closed the app?

Not quite. Certain background execution modes will relaunch an app in the background even if the user has removed it from the multitasking UI. I don’t have the exact list handy, and it’s changed over time, but it definitely does not include background fetch or silent push.

Share and Enjoy

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

Then how does whatsapp do this?

I tried this:

  1. Send message to phone with killed app
  2. Disabled network
  3. Launched app (not through notification)

result:

Opened app contained new message. So the app must have processed at least save some data from notification. Which means some background activity needed to occur even after app has been force closed.

Then how does whatsapp do this?

I’m able to comment on apps from other third-party developers.

Share and Enjoy

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

I tried this: Send message to phone with killed app Disabled network Launched app (not through notification)

I don’t know how whatsapp does this but, you could achieve what you are describing by implementing Notification Service Extension (it will be triggered when a notification comes in, regardless of the app state).

Then you can acces the notitication content, do network requests to your backend or store stuff locally.

You could store data using App Groups so then when launching your main app you could access that information, previously stored from the extension, without network.