leavez / cocoapods-binary

integrate pods in form of prebuilt frameworks conveniently, reducing compile time
MIT License
1.3k stars 207 forks source link

Pod/target collision #165

Open harryt04 opened 1 year ago

harryt04 commented 1 year ago

Here's my error message: [!] Oops, you came across a limitation of cocoapods-binary.

The plugin requires that one pod should have ONLY ONE target in the 'Pod.xcodeproj'. There are mainly 2 situations causing this problem:

  1. One pod integrates in 2 or more different platforms' targets. e.g.

    target 'iphoneApp' do
      pod 'A', :binary => true
    end
    target 'watchApp' do
      pod 'A'
    end
  2. Use different subspecs in multiple targets. e.g.

    target 'iphoneApp' do
      pod 'A/core'
      pod 'A/network'
    end
    target 'iphoneAppTest' do
      pod 'A/core'
    end

Related pods: ["RCT-Folly", "React-Core", "React-Core"], target names: ["RCT-Folly.default-Futures", "React-Core.common", "React-Core-9d1fe9bd"]

I've been trying for days to get past this error, but I can't. Manually specifying pods with the :binary flag gets me passed this issue, but it task over an hour to install and precompile, and it appears it is installing a duplicate of the pods. Here is my Podfile:

plugin 'cocoapods-binary'
plugin 'cocoapods-static-swift-framework'

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text', :modular_headers => true

platform :ios, '11.0'
use_frameworks! :linkage => :static
all_binary!
set_custom_xcodebuild_options_for_prebuilt_frameworks "DEBUG_INFORMATION_FORMAT=dwarf"
enable_bitcode_for_prebuilt_frameworks!
inhibit_all_warnings!

target 'xrmobile' do
  config = use_native_modules!

  use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :hermes_enabled => true,
  )

  # skip flipper on TF_BUILD builds
  if !ENV['TF_BUILD']
    use_flipper!
  end

  post_install do |installer|
    if !ENV['TF_BUILD']
      flipper_post_install(installer)
    end
    react_native_post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)

    installer.pods_project.targets.each do |target|
      if target.name == "React-Core-AccessibilityResources" || target.name == "React-Core.common-AccessibilityResources"
        target.remove_from_project
      end
    end
  end
end

Thanks for your feedback!

If it's a bug: