2

The two libs are AFNetworking and libcomScore.a. In AFHttpClient.h, extern NSString * const AFNetworkingReachabilityDidChangeNotification;

In AFHttpClient.m, NSString * const AFNetworkingReachabilityDidChangeNotification = @"***";

Somehow in some class in the comScore static lib, AFNetworkingReachabilityDidChangeNotification is redefined, causing error

duplicate symbol _AFNetworkingReachabilityDidChangeNotification in: comScore-iOS-ARMV7_ARMV7S_ARM64-2.1403.14/comScore-iOS-ARMV7_ARMV7S_ARM64-2.1403.14/comScore/libcomScore.a(CSReachabilityManager.o) /Users/apple/lib***.a(AFHTTPClient.o)

I don't want to touch the code in AFNetworking(although I can easily fix it by rename the const.) So does anybody have any idea ?

Szu
  • 2,254
  • 1
  • 21
  • 37
njuxjy
  • 415
  • 4
  • 13
  • You are right. I think the external library uses `AFNetworking`, try remove the original `AFNetworking` by just unchecking all .m class from settings, and try to import AFNetworking from the library itself. Or, Since you can't change anything in the library, change outside. – iphonic Apr 03 '14 at 09:05
  • I use lipo to check the inside of libcomScore.a, turns out it isn't using any AFnetworking related file. So I wonder if the lib defines some constant value which just happens to have the same name(AFNetworkingReachabilityDidChangeNotification) in the AFNetworking lib. I rename it to AFNetworkingReachabilityDidChangeNotification111, and the link error disappears, but changing the AFNetworking code is not what I want. – njuxjy Apr 03 '14 at 09:21
  • @MartaRodriguez I contacted the SDK provider and let them change their code... Turns out they copied some codes from AFNetworking and didn't rename some variables. – njuxjy May 23 '14 at 01:08
  • Great! Let see if they publish a new version soon. Thanks @njuxjy!! – Marta Rodriguez May 26 '14 at 07:45

1 Answers1

1

Check importation of file you might be importing .m file instead of .h file such like

#import "myClassName.m"
iPatel
  • 46,010
  • 16
  • 115
  • 137
  • Adding only Reachability.h to the project (and not Reachability.m) worked and http://stackoverflow.com/questions/4839981/symbols-not-found-for-architecture-i386 – iPatel Apr 03 '14 at 09:11
  • 1
    I don't think it has something to do with the Reachability file, it's just that AFNetworkingReachabilityDidChangeNotification is defined in two libs. I do have Reachability.h imported by some classes in project, but AFNetworking isn't using Reachability. – njuxjy Apr 03 '14 at 09:12