I get duplicate symbols error after I updated my Xcode
. (find the code down) Does anybody get this too? And how could be solved?
I tried to remove
I understand most people are solving this by either the No Common Blocks or the Dead Code setting, but that is actually a workaround for the real issue. In my case, I was using a Pod file that was adding the same libraries I already had linked, so basically I removed the duplicate files in my Build Phases link libraries that were already compiled in my Pod file and the Archive feature worked.
In your Xcode 9 project you will see left hand side 3 column search icon click that then search for: -Objc in the search bar and then you will see a pod config file open that. Now remove the -ObjC from the inherited it will solve the issue.
The solution is in this post. You're not up to date with this, but at least it solves the problem for now and at least in my scenario I don't have any problems with that version.
These are the steps that I took to resolve this issue:
for my case, Xcode 9 , we were declaring constants in some header file
Constants.h
static NSString *const kSomeString = @"SomeString";
so importing Constants.h in multiple .m files causes the duplicated symbols
Solution:
Constants.h
extern NSString * const kSomeString;
Constants.m
NSString *const kSomeString = @"SomeString";
I did not want to change any of these settings since no one really knows what other side effects these may have. So I iust globally searched for that variable name, replaced the name the caused the conflict in one class to variable_Classname.
That solved the issue for me without changing any setting