I stumbled across this compilation error while adding Core Data support to my latest app-in-progress.
Undefined symbols for architecture i386:
“_OBJC_CLASS_$_NSManagedObject”, referenced from:
_OBJC_CLASS_$_Show in Show.o
“_OBJC_METACLASS_$_NSManagedObject”, referenced from:
_OBJC_METACLASS_$_Show in Show.o
Fortunately, it’s an easy fix – my project was missing the Core Data framework. After adding it and rebuilding, everything was fine.
The ridiculous part, though, is that despite adding a new Core Data model to my project, creating an entity, and generating an NSManagedObject subclass, Xcode wasn’t smart enough to actually add the Core Data framework for me.
I’m gonna let you in on a little secret, Apple. If someone adds a new Core Data model to their project, and then adds an entity, and then generates NSManagedObject subclasses, it’s probably because, you know, they want to use Core Data. So just add the add the stupid framework automatically and save us all some headaches.
By comparison, Visual Studio does it right, and automatically adds the necessary Entity Framework references for you when you add a new Entity Data Model. There is no reason Xcode shouldn’t do it too (aside from Apple’s general apathy towards their developer tools, that is).