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.
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-nativeversion, 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_configurationmarker 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:
pod install, when the resolved version doesn't match the.artifacts-versionstamp 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, soPodfile.lockis unaffected.[RNCore]phase compares the tarballs' stamp with the extracted framework's stamp and, on mismatch, writesstaleinto.last_build_configurationso 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_FRAMEWORKStoggle, warm sandboxes, removed Pods, and interrupted builds, and be a no-op (a couple of file reads) when nothing changed.PR
Addressed by #99185.