Ensuring Successful Video Uploads in iOS Background Mode(terminated state)

If we start uploading a video file from the foreground and then switch to another app or press the home button, we can enable background processing by selecting the 'Background processing' option in the app's background modes. We utilize URLSession to handle the upload. I have a few questions regarding this process:

  1. If the user manually kills the app, will the upload continue in the background?
  2. For files around 100 MB, if the user locks the phone while the upload is in progress (and the app is in the background but not terminated), will the upload still be successful?
  3. Does Apple provide any additional APIs that would facilitate successful file uploads even if the user terminates the app?

I would appreciate any solutions or insights you can provide. Thank you!

Answered by DTS Engineer in 806990022
If the user manually kills the app, will the upload continue in the background?

No. If the user manually removes the app from the multitasking API, iOS interprets that as strong sign that the user doesn’t want it running. Given that, it terminates most background activity related to the app, including any tasks in URLSession background sessions.

For files around 100 MB, if the user locks the phone while the upload is in progress (and the app is in the background but not terminated), will the upload still be successful?

There’s no way to answer that definitively. The user could turn the phone off and then leave it off. However, in general, a URLSession background session should be able to deal with a 100 MB upload just fine.

Does Apple provide any additional APIs that would facilitate successful file uploads even if the user terminates the app?

No.

However, there are things you can do to improve the reliability of your uploads, including:

Share and Enjoy

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

If the user manually kills the app, will the upload continue in the background?

No. If the user manually removes the app from the multitasking API, iOS interprets that as strong sign that the user doesn’t want it running. Given that, it terminates most background activity related to the app, including any tasks in URLSession background sessions.

For files around 100 MB, if the user locks the phone while the upload is in progress (and the app is in the background but not terminated), will the upload still be successful?

There’s no way to answer that definitively. The user could turn the phone off and then leave it off. However, in general, a URLSession background session should be able to deal with a 100 MB upload just fine.

Does Apple provide any additional APIs that would facilitate successful file uploads even if the user terminates the app?

No.

However, there are things you can do to improve the reliability of your uploads, including:

Share and Enjoy

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

Accepted Answer

Thank you for your prompt response.

I would like to clarify a few points, please correct me if I’m wrong:

  1. When a user "force quits/kills" the app by swiping it up, the background process will terminate. Any ongoing uploads will stop, and we cannot initiate new uploads in the background until the user relaunches the app.
  2. After the app is "force quit/killed" by swiping up, is there any way to resume the app and start uploading again via notifications?
  3. I’ve noticed apps like WhatsApp and iPhone's Photos app seem to sync data in the background even after being "force quit/killed" by the user. If they manage this, it suggests there might be a special API at Apple’s side that allows this functionality, but it doesn’t seem to be public.

Is there a special API available that enables background file uploads (similar to the Photos app) after a user force quits the app(by swipe up)? If so, how can we gain access to it?

We are developing a medical application specifically for Parkinson's patients. The app uploads exercise videos to the server for analysis of the exercise results. If you require more details about our app to evaluate whether we can access such an API, please let me know, and I’ll provide further information.

Additionally, if we have 5 to 10 video files that need to be uploaded to the server. What would be the best approach for this?

  1. Should we upload the videos in parallel (i.e., upload all files simultaneously)?
  2. Or, should we upload them sequentially (one by one)?

Based on my findings, when the app is in the background and a new task like an upload is initiated, there is a "rate limiter" that can cause increasing delays with each task. I came across this in the following discussion: Apple Developer Forums.

Please advise on the best approach.

Ensuring Successful Video Uploads in iOS Background Mode(terminated state)
 
 
Q