When I try running my Xcode Project it fails with an error stating that I have duplicate symbols. I looked online where the find these duplicates but have had no luck:
Using Xcode 8, "Update project to recommended settings" option turned ON 'No Common Blocks' for my project.
Turning it back to OFF fixed everything up.
If you are moving to Xcode 7 or 8 and are opening a really old project, I've encountered this problem:
in SomeConstFile.h
NSString * const kAConstant;
in SomeConstFile.m
NSString *const kAConstant = @"a constant";
Earlier versions of the compiler assumed that the definition in the header file was extern and so including SomeConstFile.h all over the place was fine.
Now you need to explicitly declare these consts as extern:
in SomeConstFile.h
extern NSString * const kAConstant;
For me, I created a method called sampleMethod
in ViewController_A and created the same method in ViewController_B too, It caused me this error, then i changed the method name in ViewController_B to secondSampleMethod
. It fixed the error.
Seems like a Good feature to reduce the code and not to duplicate the same code in many places.
I tried changing the No Common blocks from Yes to No then enabling testability from Yes to No. It didn't worked. I Checked duplicate files also in build phases, but there is no duplicate files.
From the errors, it would appear that the FacebookSDK.framework already includes the Bolts.framework classes. Try removing the additional Bolts.framework from the project.
Plz Change setting.
Step 1: Go to TARGETS -> Build Settings -> No Common Blocks -> No
Step 2: Go to TARGETS -> Build Settings -> enable testability -> No
I got this issue because I was lazily defining a variable in my .m outside of a method, then in another .m file I was defining another variable with the same name outside a method. This was causing a global variable name duplicate issue.