Skip to content

Fix stale prebuilt React Native artifacts cache causing iOS dev build crashes #99187

Description

@MelvinBot

Background

Developers report crashes on iOS dev builds caused by a stale prebuilt React Native artifacts cache.

CocoaPods caches our prebuilt React Native artifacts by their source URL. That URL carries only the plain react-native version, so a new patches version lands at the same path and CocoaPods keeps the old extraction — it may not even re-read the podspec that downloads the tarballs. The app then silently builds against a stale artifact, leading to crashes (e.g. wrong ABI).

Upstream RN has the same issue with Debug/Release artifacts and solves it outside CocoaPods: its [RNCore] build phase re-extracts the framework whenever the .last_build_configuration marker doesn't match the current configuration.

Task

Extend the upstream re-extraction pattern to our patches version so a changed patches version invalidates the stale cache:

  • During pod install, when the resolved version doesn't match the .artifacts-version stamp of the tarballs in Pods, drop CocoaPods' memoized podspec (sandbox.remove_local_podspec) to force re-evaluation and the dSYM merge. The re-read podspec is byte-identical, so Podfile.lock is unaffected.
  • During the build, a small prelude prepended into the [RNCore] phase compares the tarballs' stamp with the extracted framework's stamp and, on mismatch, writes stale into .last_build_configuration so RN's own script re-extracts from the fresh tarballs. This reuses the upstream extraction machinery instead of duplicating it.

The change should cover patches version changes, the RCT_SYMBOLICATE_PREBUILT_FRAMEWORKS toggle, warm sandboxes, removed Pods, and interrupted builds, and be a no-op (a couple of file reads) when nothing changed.

PR

Addressed by #99185.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions