I have tested that BGAppRefreshTaskRequest works as expected when app is still in the memory, but when I killed the app this seems not being triggered. So my question will the BGTask will ever run if the app is killed by user.
I checked the documentation for BGTaskScheduler and it says
Background tasks give your app a way to run code while the app is suspended.
Which means that this will not schedule any task if the app is killed.
But on the other hand we have Handle background events
Which tells that
If your app isn’t running when an event arrives, the system launches the app and moves it directly to the background, following this sequence:
- The system launches the app and follows the initialization sequence described in About the app launch sequence.
- UIKit calls the app delegate’s applicationDidEnterBackground(_:) method.
- UIKit delivers the event that caused the launch.
- The app’s snapshot is taken.
- The app may be suspended again.
So I'm bit confused. Will background refresh gets triggered when app is killed.