Does NSUrlSession continue to transfer files if the application is killed from the task manager?

I tried various samples from the Internet (the last one is this one ) to better understand NSUrlSession .

What I was hoping to see: file downloading will continue even if the application that caused them is killed (for example, by the user through the task manager). However, this does not happen.

Is this a configuration problem or is background file transfer not working if the application terminates? I thought the whole idea was that iOS would restart the application.

+6
source share
2 answers

No - the application does not restart to download phonograms when the user has the strength to exit.

IOS8 documentation for application: didReceiveRemoteNotification: fetchCompletionHandler: says:

Use this method to handle incoming remote notifications for your application. Unlike an application: the didReceiveRemoteNotification method: a method that is called only when your application is running in the foreground, the system calls this method when your application is running in the foreground or background. In addition, if you enable remote notifications in the background, the system launches your application (or wakes it from a paused state) and puts it in the background when a notification is received. However, the system does not automatically launch your application, if the user has the power to quit it. In this situation, the user must restart the application or restart the device before the system again tries to start the application automatically.

0
source

If the system kills your application and your background session has active downloads, your downloads will continue and the system will start your application after the download is complete. However, if the user leaves the application, all tasks will be canceled.

Documentation for backgroundSessionConfigurationWithIdentifier:

If the iOS application terminates with the system and restarts, the application can use the same identifier to create a new configuration object and session and receive the status of transfers that were performed at the time of termination. This only applies to normal system application termination. If the user terminates the application from the multitasking screen, the system cancels all sessions background translations. In addition, the system does not automatically restart applications that were forcibly terminated by the user. The user must explicitly restart the application before the transfer starts again.

+7
source

Source: https://habr.com/ru/post/973136/


All Articles