IOS background information

I am a little confused with background fetching. I read in the Apple Developer documentation that fetching happens when the OS decides what it should, the user has no control over the background fetching, and in the Apple Developer forum from an Apple employee says that if the user kills the app (double tap on the house and swipe ) there will be no background fetch, in which case the user can control the selection of the background. So can someone please clarify to me if the user killed the application using the task manager, background fetching will still continue in the background or be killed at the same time as the application.

Apple Documentation:

https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html#//apple_ref/doc/uid/TP40007072-CH4-SW1

+3


source to share


3 answers


From the doc you link:

When a good opportunity arises, the system wakes up or starts your application in the background and calls the application's delegates: executeFetchWithCompletionHandler: method.

So it seems that the system may be running in the background an application that is not running, so it does a background fetch. On the other hand, although later in the doc you might read:



In most cases, the system will not restart applications after being forced to terminate by the user. One of the exceptions is location apps, which in iOS 8 and later restarts after being force quit by the user. In other cases, however, the user must explicitly launch the application or restart the device before the application can automatically run in the background by the system.

So the Apple engineer is right: Forcing an app to shut down puts it in a special case where background fetching is no longer allowed.

+6


source


If the user feels the need to allow background operations, he will not kill the application. But when he kills him, it is appropriate to disable background selection. The user can only control if the background fetch should happen or not, letting it stay in the background / killing the application. But once the application is in the background, the user has no control over "when" the background is fetched. The OS determines it based on how free it is.



+1


source


I think this quote (from the linked document) is the most important for the scenario I describe:

Once configured, your NSURLSession object seamlessly disables the loading and uploading of tasks to the system at appropriate times. If tasks complete while your application is running (in the foreground or background), the session object notifies its delegate in the usual way. If the tasks are still pending and the system shuts down your application, the system automatically continues to manage tasks in the background. If the user exits your application, the system cancels any pending tasks.

0


source







All Articles