0

I'm trying to add BuddySDK to existing project which contains following pods installed:

platform:ios, '7.0'
pod 'RestKit', '~> 0.23'
pod 'SSKeychain', '~> 1.2'
pod 'Reachability', '~> 3.1'

After adding pod 'BuddySDK', '~> 2.0' to the project I'm getting error in Xcode like below:

 /Users/Damiano/Library/Developer/Xcode/DerivedData/XXXXXXXXX-bgsmofalkolyjqamlxutjirazrta/Build/Products/Debug-iphoneos/libPods.a(BPAFURLRequestSerialization.o)
duplicate symbol _OBJC_CLASS_$_AFHTTPBodyPart in:
    /Users/Damiano/Library/Developer/Xcode/DerivedData/XXXXXXXXX-bgsmofalkolyjqamlxutjirazrta/Build/Products/Debug-iphoneos/libPods.a(AFHTTPClient.o)
    /Users/Damiano/Library/Developer/Xcode/DerivedData/XXXXXXXXX-bgsmofalkolyjqamlxutjirazrta/Build/Products/Debug-iphoneos/libPods.a(BPAFURLRequestSerialization.o)
duplicate symbol _OBJC_METACLASS_$_AFHTTPBodyPart in:
    /Users/Damiano/Library/Developer/Xcode/DerivedData/XXXXXXXXX-bgsmofalkolyjqamlxutjirazrta/Build/Products/Debug-iphoneos/libPods.a(AFHTTPClient.o)
    /Users/Damiano/Library/Developer/Xcode/DerivedData/XXXXXXXXX-bgsmofalkolyjqamlxutjirazrta/Build/Products/Debug-iphoneos/libPods.a(BPAFURLRequestSerialization.o)
ld: 39 duplicate symbols for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I was searching for solution on other asked questions like this but without any luck. It looks like an error occurred because BuddySDK contains AFNetworking classes which already exist in RestKit. enter image description here

After deleting RestKit pod from Podfile the problem disappears. Does anyone can tell me what should I do to successfully install both pods (RestKit and BuddySDK) ?

Thanks in advance

Community
  • 1
  • 1
sonoDamiano
  • 185
  • 1
  • 12

2 Answers2

1

Both RestKit and BuddySDK rely on AFNetworking. The problem is that BuddySDK's spec does not add this as a dependency in CocoaPods but bundles AFNetworking themselves. Because of this there are duplicate symbols when multiple versions of AFNetworking are included in your project. To fix this you should open an issue on the BuddySDK GitHub page so they can fix this.

Keith Smiley
  • 61,481
  • 12
  • 97
  • 110
  • Thanks Keith, I've added issue to the BuddySDK GitHub page. Here is the link: https://github.com/BuddyPlatform/Buddy-iOS-SDK/issues/123 – sonoDamiano Jul 29 '14 at 08:04
0

Buddy provides both a pre-compiled library as well as Cocoapods support. Any open source dependencies are "wrapped" into Buddy-specific names as to prevent the duplicate symbol problem when deploying as a pre-compiled binary.

I believe the problem you are having is that you have included BuddySDK with both the pre-compiled library as well as the Cocoapod.

Keith's explanation is true for most cases, however :).

Erik Kerber
  • 5,646
  • 7
  • 38
  • 56
  • Since his duplicate symbols are from AFNetworking I think that's what's getting included twice. – Keith Smiley Jul 29 '14 at 16:25
  • @KeithSmiley It is. The issue was resolved, and was a "bug" in the way we work around duplicate symbols. https://github.com/BuddyPlatform/Buddy-iOS-SDK/issues/123 – Erik Kerber Jul 30 '14 at 05:51