Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with sharing pods with multiple targets #11901

Open
1 task done
nrajput05 opened this issue May 11, 2023 · 6 comments
Open
1 task done

Issue with sharing pods with multiple targets #11901

nrajput05 opened this issue May 11, 2023 · 6 comments

Comments

@nrajput05
Copy link

nrajput05 commented May 11, 2023

Report

What did you do?

I want to keep Braintree/ApplePay pod in a child target which should have some common pods as well. Here is how the pod file looks like

# Uncomment the next line to define a global platform for your project
platform :ios, '13.0'

use_frameworks!

def common_pods
  pod 'Flurry-iOS-SDK/FlurrySDK'
  pod 'Braintree'
  pod 'Braintree/Venmo'
  pod 'SwiftLint'
  pod 'JTAppleCalendar'
  pod 'MaterialComponents/TextControls+FilledTextFields'
end
  
target 'testAllDeps' do
  common_pods
  pod 'Braintree/ApplePay'

end

target 'testCommonDeps' do
  common_pods

end

What did you expect to happen?

testCommonDeps compiles successfully but testAllDeps fails with these errors:
Multiple commands produce '/Users/xxxx/Library/Developer/Xcode/DerivedData/testFlurry-dswkraujlkgxwmdvcldydpsuplzu/Build/Products/Debug-iphonesimulator/XCFrameworkIntermediates/Braintree/PayPalDataCollector/PPRiskMagnes.framework'

CocoaPods Environment

Stack

   CocoaPods : 1.12.1
        Ruby : ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin21]
    RubyGems : 3.4.10
        Host : macOS 12.6.1 (21G217)
       Xcode : 14.2 (14C18)
         Git : git version 2.37.1 (Apple Git-137.1)
Ruby lib dir : /opt/homebrew/Cellar/ruby/3.2.2/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/

Installation Source

Executable Path: /opt/homebrew/Cellar/cocoapods/1.12.1/libexec/bin/pod

Plugins

cocoapods-deintegrate : 1.0.5
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.1
cocoapods-trunk       : 1.6.0
cocoapods-try         : 1.2.0

@paulb777
Copy link
Member

This is not a CocoaPods issue. It is not possible to link a static framework into both the app and dynamic frameworks. See the explanation at https://github.com/firebase/firebase-ios-sdk/blob/master/docs/firebase_in_libraries.md

@nrajput05
Copy link
Author

But I am just trying to have different pods for two app targets. Isn't that possible? Where did I mention the static framework?

@paulb777
Copy link
Member

Reopening since it's dynamic:

file ./Build/Products/Debug-iphonesimulator/XCFrameworkIntermediates/Braintree/PayPalDataCollector/PPRiskMagnes.framework/PPRiskMagnes
./Build/Products/Debug-iphonesimulator/XCFrameworkIntermediates/Braintree/PayPalDataCollector/PPRiskMagnes.framework/PPRiskMagnes: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [arm64:Mach-O 64-bit dynamically linked shared library arm64]
./Build/Products/Debug-iphonesimulator/XCFrameworkIntermediates/Braintree/PayPalDataCollector/PPRiskMagnes.framework/PPRiskMagnes (for architecture x86_64):	Mach-O 64-bit dynamically linked shared library x86_64
./Build/Products/Debug-iphonesimulator/XCFrameworkIntermediates/Braintree/PayPalDataCollector/PPRiskMagnes.framework/PPRiskMagnes (for architecture arm64):	Mach-O 64-bit dynamically linked shared library arm64

@paulb777 paulb777 reopened this May 12, 2023
@nrajput05
Copy link
Author

@paulb777 Any update on this issue please? Is there any other way you would like to suggest to have pods separately for separate targets? I can live with the workaround for now but managing two codebases one with ApplePayPod and other without is a pain.

@orta
Copy link
Member

orta commented May 19, 2023

@nrajput05 you're welcome to look into it and send pull requests if you have a pressing time constraint. CocoaPods is an open source run by volunteers in their spare time.

@nrajput05
Copy link
Author

@nrajput05 you're welcome to look into it and send pull requests if you have a pressing time constraint. CocoaPods is an open source run by volunteers in their spare time.

Can you point me in some direction of what is causing this issue in terms of the internal working of Cocoapods?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants