Simperium is giving me the following error:
ld: duplicate symbol [REDACTED]/Simperium.framework/Simperium(SPManagedObject.o) and [OTHER-REDACTED]/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/i386/SPManagedObject.o
Any idea what causes this duplicate symbol bug? (I put REDACTED in there so it's not specific to my app)
You'll see this error if you accidentally auto-generate .h and .m files for the SPManagedObject entity in the model editor. You should only auto-generate files for your own entities, since Simperium.framework provides the SPManagedObject class for you.
Related
Im generating my core data model after changing my models files using Editor -> Create NSManagedObj...
I changed an entity relationship to a different entity (if this matters)
Iv cleaned my project and build folder.
But the generated files don't seem to be correct, they include files such as 'Entity.h'
Which doesn't exist... As the only class files i see are 'Entity+CoreDataClass.h'
So i change the name manually to the all above errors and then i get a linker error:
duplicate symbol _OBJC_CLASS_$_Userinfo in:
/Users/Me/Library/Developer/Xcode/DerivedData/test-fxdxcviituhcmoegqygwirddhuir/Build/Intermediates/test.build/Debug-iphonesimulator/test.build/Objects-normal/x86_64/Userinfo+CoreDataClass.o
duplicate symbol _OBJC_METACLASS_$_Userinfo in:
/Users/Me/Library/Developer/Xcode/DerivedData/test-fxdxcviituhcmoegqygwirddhuir/Build/Intermediates/test/Debug-iphonesimulator/test/Objects-normal/x86_64/Userinfo+CoreDataClass.o
ld: 2 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Originally i created the project using an older version of Xcode, where the entity files such as 'Entity.h" were generated... Is this some sort of bug with Xcode after updating?
My entities are using the 'manual/none' codegen option. But i notice after building that the entity with the above linker error automatically changes to 'Class Definition'?
EDIT:
Ok so setting the codegen to class definition to all entities stops the wrong file import errors. (but then still revert back to 'manual/none' afterwards. Except for my newly created entity.
Where there is the error in the derriveddata for the +CoreDataClass.m file... where it does not include the +CoreDataClass in the import name.
My +CoreDataClass.m file within my project does not include this error and is correct with the +CoreDataClass.
My project generated file:
#import "Userinfo+CoreDataClass.h"
#import "User+CoreDataClass.h"
#implementation Userinfo
#end
Where the error exists: (in derived sources)
#import "Userinfo+CoreDataClass.h"
#import "User.h"
#implementation Userinfo
#end
Try to click on project. Next click the "Show version editor" (the top right button on the picture) button and try to find duplicated references and remove it.
Should solve the problem
I think I found the answer, in your xcddatamodel file after choosing your entity. On the right panel, you will see a "Code Generation" DropDown. It might default to Swift, change it to Objective c and build the project. Your file will be generated.
I was trying to create NSManagedObject subclasses (2 related entities) automatically in Xcode. They are generated like this:
However, before I do anything further, when I tried to build and run it, a link error occur, as shown:
duplicate symbol _OBJC_CLASS_$_Photo in:
/Users/Kefeng/Library/Developer/Xcode/DerivedData/Photomania-aellrakjngugnzcgrleiytvrfvyt/Build/Intermediates/Photomania.build/Debug-iphonesimulator/Photomania.build/Objects-normal/x86_64/Photo+CoreDataClass.o
duplicate symbol _OBJC_METACLASS_$_Photo in:
/Users/Kefeng/Library/Developer/Xcode/DerivedData/Photomania-aellrakjngugnzcgrleiytvrfvyt/Build/Intermediates/Photomania.build/Debug-iphonesimulator/Photomania.build/Objects-normal/x86_64/Photo+CoreDataClass.o
duplicate symbol _OBJC_CLASS_$_Photography in:
/Users/Kefeng/Library/Developer/Xcode/DerivedData/Photomania-aellrakjngugnzcgrleiytvrfvyt/Build/Intermediates/Photomania.build/Debug-iphonesimulator/Photomania.build/Objects-normal/x86_64/Photography+CoreDataClass.o
duplicate symbol _OBJC_METACLASS_$_Photography in:
/Users/Kefeng/Library/Developer/Xcode/DerivedData/Photomania-aellrakjngugnzcgrleiytvrfvyt/Build/Intermediates/Photomania.build/Debug-iphonesimulator/Photomania.build/Objects-normal/x86_64/Photography+CoreDataClass.o
ld: 4 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I tried several times by creating new projects and do the same thing. My original intention is to add some custom methods into those to subclasses. But when I add anything into e.g. Photo+CoreData.h/m, the same error as above showed up.
I found some answers about the "double include" or "save files to the wrong directory", but I didn't do that. Anybody have any idea about this?
If you do not generate managed object subclass automatically, then don't forget to check "Codegen" settings for an Entity in Data Model Inspector:
Edit:
Thanks to some help from #iPeter, found the following:
After doing Editor > Generate NSManagedObject files, if you trash the files BEFORE building, your project should build no problems.
Then #import "myManagedObjectName+CoreDataClass.h" (where the MO name is the one in the entity inspector in core data) into any classes where you require those Managed Objects.
In other words, you don't require any of the actual ManagedObject files in your folder. Xcode keeps the generated ones in your Derived Data folder.
If for some reason you need those files to remain in your file directory, the following workaround will work.
Go to your Target and delete the CoreDataClass sources in your Compile Sources.
Leaving you with this:
Most of the new attributes / relationships I added after the initial generation of ManagedObject subclasses were available as properties after a build. In one case where I renamed an existing relationship, I had to do Editor > Generate NSManagedObject Subclasses again, then I trashed the new files in my folder, built, and everything worked OK.
Just wrote a blog post that includes this info for anybody interested.
You should delete all these entities, change "Codegen" settings to "Manual/None" for them in Data Model Inspector, and generate entities again. It works good! You don't need to remove +CoreDataClass.h files from Compile Source. You don't need to mark entities as abstract. You don't need to generate classes by yourself. You should change only "Codegen" settings and regenerate entities automatically.
late post ... but for me was simply a copy paste of an entity, Xcode does not seem to change the original class name associated with the entity (observed on Xcode 9.0.1)
You need to remove the CoreData related sub class generated by yourself, and you can keep the #import line with those classes, now all those files will be generated automatically when build the project.
I recently tried the above answer and it failed.
Somehow, Xcode was still generating the files.
I solved it using the following method:
Mark all entities as Abstract
Build
Remove Abstract flag
Build
Success !
This sounds like a bug in Xcode...
I've created a single view iOS app. Added pod 'XBPageCurl'. When I add #import "XBPageCurlView.h" to any view controller I get this error
duplicate symbol _XBAnimationInterpolatorEaseInOut in:
/Users/alexander/Library/Developer/Xcode/DerivedData/CurlTest-fphbvwtzauotgidxuqzdympohxqz/Build/Intermediates/CurlTest.build/Debug-iphoneos/CurlTest.build/Objects-normal/arm64/ViewController.o
/Users/alexander/Library/Developer/Xcode/DerivedData/CurlTest-fphbvwtzauotgidxuqzdympohxqz/Build/Products/Debug-iphoneos/libPods-XBPageCurl.a(XBAnimation.o)
ld: 4 duplicate symbols for architecture arm64
This is not happening with a test project from github.
Any idea how to get rid of it?
In build settings set "No Common Blocks" to NO
I removed any reference of interpolator block and moved the logic from it to - (BOOL)step:(NSTimeInterval)dt
There are two situations, that I am aware of, that cause the following errors:
ld: warning: instance method 'resetAudioSystem' in category from /opentok-ios-sdk/Opentok.framework/Opentok(OTPublisher+AudioSnoop.o) conflicts with same method from another category
ld: warning: instance method 'attachAudioSnoopBlock:' in category from /opentok-ios-sdk/Opentok.framework/Opentok(OTPublisher+AudioSnoop.o) conflicts with same method from another category
ld: warning: instance method 'setVideoSnoopDelegate:' in category from /opentok-ios-sdk/Opentok.framework/Opentok(OTPublisher+VideoSnoop.o) conflicts with same method from another category
Possibility 1: A category instance method is declared twice. (Described here: SO)
But, When I do a search of any of the 3 instance methods (in Xcode or Grep) I do not find it declared twice.
Possibility 2: Accidentally importing a .m file. (Described here: SO)
But, I checked all my imports and I only import the framework once in the whole project. Also, only shows up once in Build Phases.
My program runs without crashing, presumably because the last category definition added is used and it happens to be correct. (Source)
Question 1: Is there a way to tell, prior to its addition, where the two categories are located?
Question 2: Any other ideas about how to resolve this?
Note: The Opentok Framework is a binary
Occurs in :
xcode 4.6 & xcode 5
iOS6 & iOS7
I had this warnings because I accidentally imported the implementation file of a category instead of it's header file. So:
wrong: #import 'MyClass+MyCategory.m'
right: #import 'MyClass+MyCategory.h'
I had this error, because I literally pasted my methods' implementation to header file (*.h). It worked well however; the only symptom - warnings.
Check whether your implementation is in correct (*.m) file.
This look like a linker bug. Maybe the SDK got linked more than once, or -ObjC is missing/present where it should not be. Check linker flags. Try deleting all OpenTok frameworks, make sure its missing in your projects, then re-download it and install again.
In my case the header file containing the categories was imported twice for a class.
It wasn't obvious because another header file also imported the same header.
In other words
//Class_with_warnings.h:
#import "Offending_Header.h" // import #1
#import "Class_A.h" // import #2
//Whereas Class_A.h:
#import "Offending_Header.h" // import #2
I got an error while compiling my code. The issue identifier labels it as 'Apple Mach-O Link Linker command failed'. I have no clue what this is so I have not been able to find a solution.
duplicate symbol _OBJC_METACLASS_$_XYZFlipsideViewController in:
/Users/studentuse/Library/Developer/Xcode/DerivedData/RSC-
aardgrngtzicssfffcbdqsezpqmv/Build/Intermediates/RSC.build/Debug-
iphonesimulator/RSC.build/Objects-normal/i386/XYZAppDelegate.o
/Users/studentuse/Library/Developer/Xcode/DerivedData/RSC-
aardgrngtzicssfffcbdqsezpqmv/Build/Intermediates/RSC.build/Debug-
iphonesimulator/RSC.build/Objects-normal/i386/XYZFlipsideViewController.o
ld: 6 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation) //This
line has the mistake
What is the problem with the code?
(This is only part of the code.)
The problem is that you have defined the implementation of the class XYZFlipsideViewController twice, and the linker can't figure out which definition you meant:
duplicate symbol _OBJC_METACLASS_$_XYZFlipsideViewController
The two places it is defined in are these two object files:
XYZAppDelegate.o
XYZFlipsideViewController.o
There are two possible explanations:
You have a #implementation XYZFlipsideViewController ... #end block in both of the source files XYZAppDelegate.m and XYZFlipsideViewController.m, or
You have the #implementation ... #end block inside a header file which is #include/#imported by both of those source files
In the first case, the solution is to remove one of the #implementation blocks. In the second case, the solution is to move the #implementation block from the header into the source file, but keep the #interface block in the header file.
It's important to understand the distinction between #interface and #implementation -- the former says "Here is the name of a class, the names of its instance variables, and the names of its member functions", whereas the latter says "Here are all the definitions of the class's properties and member functions".
Make sure and check your actual project directory for multiple files of the file it says you have duplicates of. Sometimes I forget to click send To trash vs remove reference when deleting and re creating files.
I am not sure this is your problem, but I have had similar problems like this before.
Good Luck! ^^