From 5369c8683d4c036b591a8f44ddb3cc2b4c30b225 Mon Sep 17 00:00:00 2001 From: Douglas Lowder Date: Thu, 25 May 2023 20:08:23 -0700 Subject: [PATCH] [iOS] Fix Fabric issue with React-Core pod when Xcode project has multiple targets --- packages/react-native/scripts/cocoapods/new_architecture.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/react-native/scripts/cocoapods/new_architecture.rb b/packages/react-native/scripts/cocoapods/new_architecture.rb index 1b66a14684cec6..192d2702645a9f 100644 --- a/packages/react-native/scripts/cocoapods/new_architecture.rb +++ b/packages/react-native/scripts/cocoapods/new_architecture.rb @@ -16,7 +16,8 @@ def self.set_clang_cxx_language_standard_if_needed(installer) language_standard = nil installer.pods_project.targets.each do |target| - if target.name == 'React-Core' + # The React-Core pod may have a suffix added by Cocoapods, so we test whether 'React-Core' is a substring, and do not require exact match + if target.name.include? 'React-Core' language_standard = target.resolved_build_setting("CLANG_CXX_LANGUAGE_STANDARD", resolve_against_xcconfig: true).values[0] end end @@ -61,7 +62,8 @@ def self.modify_flags_for_new_architecture(installer, is_new_arch_enabled) # Add RCT_NEW_ARCH_ENABLED to generated pod target projects installer.target_installation_results.pod_target_installation_results.each do |pod_name, target_installation_result| - if pod_name == 'React-Core' + # The React-Core pod may have a suffix added by Cocoapods, so we test whether 'React-Core' is a substring, and do not require exact match + if pod_name.include? 'React-Core' target_installation_result.native_target.build_configurations.each do |config| config.build_settings['OTHER_CPLUSPLUSFLAGS'] = @@new_arch_cpp_flags end