diff --git a/scripts/cocoapods/jsengine.rb b/scripts/cocoapods/jsengine.rb index b5f549f753300a..9a565c250795e0 100644 --- a/scripts/cocoapods/jsengine.rb +++ b/scripts/cocoapods/jsengine.rb @@ -37,7 +37,7 @@ def setup_hermes!(react_native_path: "../node_modules/react-native", fabric_enab def add_copy_hermes_framework_script_phase(installer, react_native_path) utils_dir = File.join(react_native_path, "sdks", "hermes-engine", "utils") - phase_name = "[RN]Copy Hermes framework" + phase_name = "[RN] Copy Hermes Framework" project = installer.generated_aggregate_targets.first.user_project target = project.targets.first if target.shell_script_build_phases.none? { |phase| phase.name == phase_name } @@ -49,8 +49,13 @@ def add_copy_hermes_framework_script_phase(installer, react_native_path) def remove_copy_hermes_framework_script_phase(installer, react_native_path) utils_dir = File.join(react_native_path, "sdks", "hermes-engine", "utils") - phase_name = "[RN]Copy Hermes framework" + phase_name = "[RN] Copy Hermes Framework" project = installer.generated_aggregate_targets.first.user_project - project.targets.first.shell_script_build_phases.delete_if { |phase| phase.name == phase_name } + target = project.native_targets.first + target.shell_script_build_phases.each do |phase| + if phase.name == phase_name + target.build_phases.delete(phase) + end + end project.save() end