1

I created a static library which uses AFNetworking in key role to comunicate with backend.While testing, everything works great but when I tried to use AFNetworking on the test application by importing it again, I'm getting bunch of duplicate symbols errors

duplicate symbol _OBJC_CLASS_$_AFURLSessionManager in:
    (AFURLSessionManager.o)
    i386/AFURLSessionManager.o
duplicate symbol _OBJC_METACLASS_$_AFURLSessionManager in:

(AFURLSessionManager.o)
i386/AFURLSessionManager.o

ld: 205 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

i tried to -force_load option to force_load the library by adding

force_load $(SOURCE_ROOT)/testLib.a

in the other linker flags instead of -ObjC but It didn't help me either.

What do i need to do in order to use it without any hacky stuff?

I found this solution here

http://atastypixel.com/blog/avoiding-duplicate-symbol-issues-when-using-common-utilities-within-a-static-library/

but It's really not practical,

rmaddy
  • 314,917
  • 42
  • 532
  • 579

0 Answers0