iOS: Does force quitting the app disables background upload using NSURLSession?

后端 未结 2 487
失恋的感觉
失恋的感觉 2020-12-09 04:02

The question is around NSURLSession and NSURLSessionUploadTask.

I\'m uploading large files to server and noticed that when I

相关标签:
2条回答
  • 2020-12-09 04:46

    I can confirm now after a bunch of testing that background task will run ok if the app is just put into background. However, if user force quit the app manually, then iOS cancels all scheduled background tasks. So next time the app is launched I'm getting all the callbacks to the delegate with the error code of a canceled task.

    Hope it helps someone looking into the same thing.

    0 讨论(0)
  • 2020-12-09 04:50

    From Apple's docs about background execution:

    If tasks have not yet finished and the system terminates your app, the system automatically continues managing the tasks in the background. If the user terminates your app, the system cancels any pending tasks.

    0 讨论(0)
提交回复
热议问题