FULL AI ANALYSIS

iOS app multipart upload restarts from zero when switching between 5G and Wi‑Fi during transfer (React Native background uploader)

Generated Oct 12, 2026, 10:57:58 PM

Analysis summary

The root cause is that during a network handoff the OS may cancel or invalidate the background NSURLSession task and only supply resumable resumeData to the app if the app's native background delegate is reliably invoked. In RN apps the JS engine and bridge can be suspended or killed during handoff; if resumeData handling or persistence is implemented in JS (or not wired into native session delegates), the ability to resume is lost and the app starts a fresh upload. Native sample apps succeed because the delegate and resumeData handling are fully native and run even when the JS runtime is paused.

Possible causes

Upload implementation relies on JS-managed state instead of native NSURLSession background delegates; resumeData is never persisted to disk.

90%

React Native bridge or JS runtime suspension during network handoff prevents capture/storage of NSURLSession resumeData.

85%

OS cancels task without providing resumeData when delegate callbacks are not installed at native layer or when session is misconfigured.

60%

Server-side expectations differ (missing Upload-Offset/Range headers) when client re-establishes without sending resume metadata.

20%

Suggested fixes

1

Diagnostic step 1

Move resume handling fully to native iOS: implement NSURLSession background configuration with native delegates that persist resumeData to file storage immediately on task completion/failure.

2

Diagnostic step 2

Ensure native delegate code runs standalone from RN JS (no reliance on bridge) so resumeData is saved even if JS is suspended. Add logs to verify delegate invoked during handoff.

3

Diagnostic step 3

Test handoff scenarios with a minimal native app reproducer to confirm iOS behavior, then mirror the native flow in RN bridge code.

4

Diagnostic step 4

On server, support resumable uploads that accept a client-supplied upload id and offset; use that as secondary protection if client resumeData is lost.

5

Diagnostic step 5

If native changes are not possible, warn users to avoid switching networks during large uploads and detect network-change events to pause uploads gracefully and retry resume after stabilizing.