Pick the fix
Uploads must continue after the user leaves the app. Which call?
Hint 1 of 1
What do background sessions need?
Choose an answer, then open Show answer below to check it.
Show answer
Answer: A backgroundSession.uploadTask(with: request, fromFile: fileURL)
Correct. File uploads in a background session continue while the app is suspended.
Why not the others?
- B
backgroundSession.uploadTask(with: request, from: data). Background sessions don't support in-memory uploads. - C
try await URLSession.shared.upload(for: request, from: data)in a Task. The task stops when the app is suspended. - D Build the multipart body in memory and send it on app launch. Memory heavy, and it doesn't survive backgrounding.