11.6 C
New York
Sunday, October 20, 2024

ios – Cocoapods Pod with subspecs fail to put in because of frameworks conflicting names


I’ve a MyProduct.xcframework that I distribute with Cocoapods in a podspec that depends on the vendored_frameworks discipline.
MyProduct.xcframework additionally relies on one other XCFramework known as MyProductCore.xcframework.

At this level I want to construct further options upon these 2 frameworks and to distribute them as Swift supply information (that import MyProductCore.xcframework).

In a nutshell, right here is the construction of my repo:

  • Frameworks folder: MyProduct.xcframework, MyProductCore.xcframework
  • FeatureA folder: SomeFunctionality xcode challenge
  • MyProduct.podspec
  • FeatureA.podspec

To devour MyProduct and its non-compulsory options (akin to FeatureA) in a podfile, it appears like this:

pod 'MyProduct' ...
pod 'FeatureA/SomeFunctionality' ...

The issue is after I run pod set up in a take a look at app, I get the next error:

Downloading dependencies
-> Putting in MyProduct (1.0.0)
-> Putting in FeatureA (1.0.0)
  - Operating pre set up hooks
[!] The 'Pods-DemoApp' goal has frameworks with conflicting names: MyProductCore.xcframework.

That is the contents of MyProduct.podspec (exhibiting solely the related bits):

Pod::Spec.new do |s|
  s.identify        = "MyProduct"
  s.model     = "1.0.0"
  s.platform    = :ios
  s.ios.deployment_target="12.0"
  s.swift_versions = ['5.9.2']
  s.supply      = { :git => "path/to/my/repo.git", :tag => "1.0.0" }
  s.requires_arc = true
  s.vendored_frameworks="Frameworks/MyProduct.xcframework", 'Frameworks/MyProductCore.xcframework'
finish

And that is the FeatureA.podspec:

Pod::Spec.new do |s|
  s.identify        = "FeatureA"
  s.model     = "1.0.0"
  s.platform    = :ios
  s.ios.deployment_target="12.0"
  s.swift_versions = ['5.9.2']
  s.supply      = { :git => "path/to/my/repo.git", :tag => "1.0.0" }
  s.requires_arc = true

  # The default subspec which can be put in mechanically.
  # Observe that it's a necessary dependency for the non-compulsory subspecs outlined under.
  s.default_subspec="Core"

  # Core subspec  
  s.subspec 'Core' do |core|
    core.vendored_frameworks="Framework/MyProductCore.xcframework"
  finish

  # Elective subspecs

  # FeatureA functionality
  s.subspec 'SomeFunctionality' do |ss|
    ss.source_files="FeatureA/SomeFunctionality/**/*.{swift, h}"
    ss.dependency 'FeatureA/Core'
  finish
finish

There is no such thing as a error when operating pod spec lint and pod lib lint instructions.

Is there one thing I am lacking for this setup to work with Cocoapods? Or is simply one thing that isn’t supported?
Thanks upfront!

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles