Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS - 2 duplicate symbols for architecture armv7

I am using Resty everywhere in my project, but now since I have to upload image to server, so I try to add another framework called RestKit to handle file upload. But when I compiled, it got error:

duplicate symbol _NewBase64Decode in:
    /Users/iforests/Library/Developer/Xcode/DerivedData/Owlch-gnysrakcbhsgkubbjjjfbahlocqi/Build/Products/Debug-iphoneos/libRestKit.a(NSData+Base64.o)
    /Users/iforests/Documents/iOSworkspace/Owlch/LRResty.framework/LRResty(NSData+Base64.o)
ld: 2 duplicate symbols for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Is there any way to solve this problem without removing LRResty (since tomorrow is the deadline of this project). Thank you all so much!

like image 646
iForests Avatar asked Aug 30 '12 15:08

iForests


2 Answers

Just had this issue when importing a new library into an existing (old) project - turns out the problem was the linker flag -all_load that was (for whatever reason) still set in the "Build Settings - Linking - Other Linker Flags" in Xcode.

After removing this flag all went fine.

like image 63
TheEye Avatar answered Oct 01 '22 21:10

TheEye


Delete these files from the Resty source.

LRResty/Classes/Categories/NSData+Base64.h LRResty/Classes/Categories/NSData+Base64.m

That will take care of the linking issue.

If it stops working because of that, rename the files and category for NSData+Base64 in the Resty code and then anywhere the Resty code imports "NSData+Base64.h", change the import to whatever you rename the category

like image 22
Jesse Black Avatar answered Oct 01 '22 20:10

Jesse Black