Repository navigation
fix(mobile): pasting or attaching a file no longer crashes iOS - #812
Merged
Merged
Conversation
expo-file-system 58.0.15 creates its background URL session, and registers it through the main-actor ExpoAppDelegateSubscriberRepository, from the module queue an upload starts on, so the first upload trips Swift's isolation check (expo/expo#54360). Resolve network sessions on the main thread, as downloads already do, and build the module from source so iOS uses the patch rather than the precompiled XCFramework. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On iOS, pasting an image into the composer (or attaching any file) crashed the app as soon as the upload started. expo-file-system 58.0.15, pulled in by the dependency update in #793, creates its background
URLSessionfrom the module queueUploadTask.startruns on and registers it throughExpoAppDelegateSubscriberRepository, a@MainActorclass, so Swift's isolation check traps:Upstream: expo/expo#54360 and #54432, closed for a missing repro. Expo's main branch still has the bug.
Fix
patches/expo-file-system@58.0.15.patch:NetworkTaskSessionManager.session(for:)resolves sessions on the main thread, hopping there synchronously from the upload queue. Downloads already start on main. This keeps the session registration synchronous, and the unsynchronized lazy sessions stay on one thread.apps/mobile/package.json:expo-file-systemgoes intoexpo.autolinking.buildFromSource. Without it, iOS links Expo's precompiled XCFramework and ignores the patch. The first rebuild still crashed until this was added.pnpm-workspace.yaml: the patch entry, plus the usualoverridespin for patched packages.Android doesn't have the bug, but its native fingerprint changes because
buildFromSourceis not platform-specific. This matchesexpo-network, which is already in the same list.Verification
iOS 27.2 simulator, dev client built from this branch, isolated dev server:
pasted-image.jpeg 401 KBchip, no crash report, and the 409,695-byte file reaches the server's attachments directory.vp run check:changedpasses.Review: Gemini 4 Neon (xhigh) found nothing blocking. Its finding on the registration race is applied (synchronous main-thread resolution instead of a deferred
Task). Not taken: an iOS-onlybuildFromSourcelist, because it replaces the shared list and would duplicate all 11 entries. Also not taken: patching the legacy module, which nothing in the app or its dependencies reaches.Made with Claude Opus 5.5 in Claude Code (Onicode).
🤖 Generated with Claude Code