Closed nrajput05 closed 1 year ago
👋 Hi @nrajput05 - thank you for raising this issue to us! It helps us a ton.
I am able to replicate using the Podfile structure you provided.
Can you tell me which of the payment methods from Braintree you are using in your app? Let me know if this is accurate:
Yes, Apple Pay is the optional one.
Thanks for confirming!
So if you structure your project like this (avoiding duplication of all Braintree pods b/w both target and just having an ApplePay-only target) things work with CocoaPods.
def common_pods
pod 'Braintree'
pod 'Braintree/Venmo'
end
target 'testWithAP' do
pod 'Braintree/ApplePay'
end
target 'testNonAP' do
common_pods
end
I also tested this out with other binaries (beyond just PPRiskMagnes
that you see in the error console), and the same issue result. This looks like a limitation of CocoaPods to me.
To confirm this is a CocoaPods specific issue, I tried the setup that you desire, but via Swift Package Manager.
I have 1 target (TestAP) with all Braintree pods that you need + BraintreeApplePay:
I have another target (TestBT_NonAP) with all the Braintree pods that you need excluding BraintreeApplePay:
I am able to build everything just fine (the host app & each individual targets).
I provided that sample Swift Package Manager app here --> DupMagnesSPM.zip for you to reference.
I saw that you opened a CocoaPods issue here. Their response is odd to me, especially since the PPRiskMagnes
framework is dynamic, not static.
Side note in case it wasn't obvious, pod Braintree
is an alias for Braintree/Core
, Braintree/Card
and Braintree/PayPal
(see our Podspec). That alias isn't possible in SPM, which is why my example includes each individual framework you need.
hmm switching to SPM isn't an option for me right now. I see the CocoaPod issues is reopened. I guess need to wait for them to come back.
Braintree SDK Version
5.21.0
Environment
Both
Xcode Version
14.2
OS Version & Device
All
Integration type
CocoaPods
Development Processor
Apple Silicon (M-series chips)
Describe the bug
I have a project where there could be two targets. One target supports ApplePay and one does not. Since apple refuses to accepts builds which have the Apple Pay Code in them but they do not use it I can not keep these 2 pods in one target and just get an appstore submission by explaining to the review team that this client of mine does not use Apple Pay and I have hidden it for this app.
In order to achieve this I tried sharing the common pods among two targets and one of them has an additional entry for Apple Pay pod. Here is how the podfile looks like:
While the testNonAP target builds and runs successfully, the testWithAP gives this error:
Multiple commands produce '/Users/xxxx/Library/Developer/Xcode/DerivedData/testWithAP-dswkraujlkgxwmdvcldydpsuplzu/Build/Products/Debug-iphonesimulator/XCFrameworkIntermediates/Braintree/PayPalDataCollector/PPRiskMagnes.framework' note: That command depends on command in Target 'Braintree.common' (project 'Pods'): script phase “[CP] Copy XCFrameworks” note: That command depends on command in Target 'Braintree.common-ApplePay' (project 'Pods'): script phase “[CP] Copy XCFrameworks”
To reproduce
Just use the above pod file and try in a sample project where you would have two targets.
Expected behavior
Both targets should compile successfully.
Screenshots
No response