Skip to content

Commit a4a3e67

Browse files
Yonomfacebook-github-bot
authored andcommitted
Fix post_install_workaround downgrading development targets (#32633)
Summary: The `__apply_Xcode_12_5_M1_post_install_workaround` script changes the `IPHONEOS_DEPLOYMENT_TARGET` to `11.0` for all pods. This causes problems if the pods were targetting `12.0` or higher. Many expo modules are targetting `12.0`. I fixed this issue by checking the existing version and only bumping the target if it is lower than `11.0`. See also: this discussion post by mikehardy reactwg/react-native-releases#1 (comment) ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [iOS] [Fixed] - __apply_Xcode_12_5_M1_post_install_workaround causing pods targetting iOS 12 and above to fail Pull Request resolved: #32633 Test Plan: ### Test (failing before this patch, passing after this patch) 1. pick an iOS Pod that has a minimum deployment target of iOS 12 or higher, I chose the Braintree package 2. `npx react-native init myrnapp` 3. Open `ios/Podfile` and add the pod as a dependency: `pod 'Braintree', '~> 5'` (and upgrade the Podfile target to 12 (`platform :ios, '12.0'`)) 4. Compile the app. Before applying this patch: ❌ Build fails because Braintree uses iOS 12 features and was downgraded to target 11.0 After applying this patch: ✅ Build succeeds Reviewed By: fkgozali Differential Revision: D32638171 Pulled By: philIip fbshipit-source-id: 0487647583057f3cfefcf515820855c7d4b16d31
1 parent 6abf8b4 commit a4a3e67

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

scripts/react_native_pods.rb

+7-3
Original file line numberDiff line numberDiff line change
@@ -548,13 +548,17 @@ def __apply_Xcode_12_5_M1_post_install_workaround(installer)
548548
# The most reliable known workaround is to bump iOS deployment target to match react-native (iOS 11 now).
549549
installer.pods_project.targets.each do |target|
550550
target.build_configurations.each do |config|
551-
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
551+
# ensure IPHONEOS_DEPLOYMENT_TARGET is at least 11.0
552+
should_upgrade = config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].split('.')[0].to_i < 11
553+
if should_upgrade
554+
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
552555
end
556+
end
553557
end
554558

555559
# But... doing so caused another issue in Flipper:
556560
# "Time.h:52:17: error: typedef redefinition with different types"
557-
# We need to make a patch to RCT-Folly - set `__IPHONE_10_0` to our iOS target + 1.
561+
# We need to make a patch to RCT-Folly - remove the `__IPHONE_OS_VERSION_MIN_REQUIRED` check.
558562
# See https://github.com/facebook/flipper/issues/834 for more details.
559-
`sed -i -e $'s/__IPHONE_10_0/__IPHONE_12_0/' Pods/RCT-Folly/folly/portability/Time.h`
563+
`sed -i -e $'s/ && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_0)//' Pods/RCT-Folly/folly/portability/Time.h`
560564
end

0 commit comments

Comments
 (0)