Search code examples
iospaypalbraintreecard.io

Conflict between the Braintree iOS SDK & Card I/O iOS SDK: duplicate symbols for architecture armv7


In the App I am developing (with Xcode 6.1, for iOS 7&8), I am using Card IO to capture the credit card information and use Braintree as the payment method. Problems happens when I include Card IO iOS SDK, together with Braintree iOS SDK which was imported by Cocoapods, I got the error:

duplicate symbol _OBJC_CLASS_$_CardIOCreditCardInfo in: /MyApp/Pods/Braintree/Braintree/PayPal/mSDK/libPayPalMobile.a(libCardIO.a-armv7-master.o) /MyApp/CardIO/libCardIO.a(libCardIO.a-armv7-master.o) duplicate symbol _OBJC_CLASS_$_CardIOPaymentViewController in: /MyApp/Pods/Braintree/Braintree/PayPal/mSDK/libPayPalMobile.a(libCardIO.a-armv7-master.o) /MyApp/CardIO/libCardIO.a(libCardIO.a-armv7-master.o) duplicate symbol _OBJC_CLASS_$_CardIOView in: /MyApp/Braintree/Braintree/PayPal/mSDK/libPayPalMobile.a(libCardIO.a-armv7-master.o) /MyApp/CardIO/libCardIO.a(libCardIO.a-armv7-master.o) duplicate symbol _OBJC_METACLASS_$_CardIOCreditCardInfo in: /MyApp/Pods/Braintree/Braintree/PayPal/mSDK/libPayPalMobile.a(libCardIO.a-armv7-master.o) /MyApp/CardIO/libCardIO.a(libCardIO.a-armv7-master.o) duplicate symbol _OBJC_METACLASS_$_CardIOPaymentViewController in: /MyApp/Pods/Braintree/Braintree/PayPal/mSDK/libPayPalMobile.a(libCardIO.a-armv7-master.o) /MyApp/CardIO/libCardIO.a(libCardIO.a-armv7-master.o) duplicate symbol _OBJC_METACLASS_$_CardIOView in: /MyApp/Pods/Braintree/Braintree/PayPal/mSDK/libPayPalMobile.a(libCardIO.a-armv7-master.o) /MyApp/CardIO/libCardIO.a(libCardIO.a-armv7-master.o) ld: 6 duplicate symbols for architecture armv7 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Turns out that Braintree includes Paypay SDK, which already contains the library of CardIO.

I have tried 1)to delete(remove reference) libCardIO.a in CardIO folder, the APP is able to be built and run, but the view controller and the camera of CardIO cannot be open properly.
2)to delete(remove reference) the Paypal folder from Braintree, got the error below.

Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_BTPayPalButton", referenced from: objc-class-ref in libPods-Vinyo-2-Braintree.a(Braintree.o) "_OBJC_CLASS_$_BTPayPalViewController", referenced from: objc-class-ref in libPods-Vinyo-2-Braintree.a(BTPaymentProvider.o)
"_OBJC_CLASS_$_BTPayPalAppSwitchHandler", referenced from: objc-class-ref in libPods-Vinyo-2-Braintree.a(BTPaymentProvider.o) objc-class-ref in libPods-Vinyo-2-Braintree.a(Braintree.o) ld: symbol(s) not found for architecture armv7 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Looking for a feasible and secure way to integrate these two SDK properly and make it work. Any ideas are appreciated! Thank you in advance!


Solution

  • Dave from card.io here.

    Your first approach is the correct one. From the information you've provided so far, I'm not sure why it didn't work for you.

    Please see https://github.com/braintree/braintree_ios/issues/53#issuecomment-58379403 for some specific advice.

    (In another week or two this should get easier, as the correct card.io headers will be included with the Braintree iOS SDK.)