Skip to content

Commit ef5ff3e

Browse files
sonicdoefacebook-github-bot
authored andcommitted
Don’t hard-code CocoaPods’s sandbox path (#32243)
Summary: When running `scripts/react_native_pods.rb`, the `Pods` directory may not be in the current working directory, for example, when calling [`pod install`](https://guides.cocoapods.org/terminal/commands.html#pod_install) with `--project-directory=ios`. Therefore, `sed` fails and, ultimately, the build fails. References: * https://rubydoc.info/gems/cocoapods/Pod%2FInstaller:sandbox * https://rubydoc.info/gems/cocoapods/Pod/Sandbox#root-instance_method ## Changelog [iOS] [Fixed] - Fix build error after running `pod install` with `--project-directory=ios` Pull Request resolved: #32243 Test Plan: 1. `npx react-native init AwesomeProject --version 0.66.0-rc.3 --skip-install` 2. `cd AwesomeProject` 3. `yarn install` 4. `pod install --project-directory=ios` This command prints “sed: Pods/RCT-Folly/folly/portability/Time.h: No such file or directory” but still exits with 0. 5. `npx react-native run-ios` The build fails because of “typedef redefinition with different types” as described in facebook/flipper#834. 6. Apply this patch using `(cd node_modules/react-native && curl https://github.com/kontist/react-native/commit/ec330f756e477e53dde891fe02fd74916d9faef0.patch | patch -p1)` 7. Re-run `pod install --project-directory=ios` 8. Re-run `npx react-native run-ios` The iOS app should now run successfully. Reviewed By: sota000 Differential Revision: D31089656 Pulled By: fkgozali fbshipit-source-id: 431898bed88f68761c7e0e6c79074dc04f43ed23
1 parent f8e4a78 commit ef5ff3e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

scripts/react_native_pods.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -364,5 +364,5 @@ def __apply_Xcode_12_5_M1_post_install_workaround(installer)
364364
# "Time.h:52:17: error: typedef redefinition with different types"
365365
# We need to make a patch to RCT-Folly - set `__IPHONE_10_0` to our iOS target + 1.
366366
# See https://github.com/facebook/flipper/issues/834 for more details.
367-
`sed -i -e $'s/__IPHONE_10_0/__IPHONE_12_0/' Pods/RCT-Folly/folly/portability/Time.h`
367+
`sed -i -e $'s/__IPHONE_10_0/__IPHONE_12_0/' #{installer.sandbox.root}/RCT-Folly/folly/portability/Time.h`
368368
end

0 commit comments

Comments
 (0)