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!
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
I also came up with same error. Generally this kind of error occurs due to duplicate classes and xibs in project folder. For Example in my project I had these classes twice ServiceRequest.h/.m
. Get rid of duplicate ones and you are good to go.
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.
The issue is that both libraries are defining the same method: NewBase64Decode.
So you could modify the source code of any one library and change the method name to something else like "RKNewBase64Decode". Remember to make changes in the *.m file as well wherever NewBase64Decode method is invoked!
Also, I have noted, if you have stupidly imported a .m, remove the import.
This occurred to me when importing a framework that contained a class with the exact same name as there was in the project.