Tuesday, November 2, 2010

Core Data - Compile error

If You get this kind of compile error,

"_OBJC_CLASS_$_NSManagedObjectContext", referenced from:
objc-class-ref-to-NSManagedObjectContext in AppDelegate.o

"_OBJC_CLASS_$_NSEntityDescription", referenced from:
objc-class-ref-to-NSEntityDescription in AppDelegate.o

"_NSSQLiteStoreType", referenced from:
_NSSQLiteStoreType$non_lazy_ptr in AppDelegate.o
(maybe you meant: _NSSQLiteStoreType$non_lazy_ptr)


"_OBJC_CLASS_$_NSPersistentStoreCoordinator", referenced from:
objc-class-ref-to-NSPersistentStoreCoordinator in AppDelegate.o

"_OBJC_CLASS_$_NSFetchRequest", referenced from:
objc-class-ref-to-NSFetchRequest in AppDelegate.o

"_OBJC_CLASS_$_NSManagedObjectModel", referenced from:
objc-class-ref-to-NSManagedObjectModel in AppDelegate.o
ld: symbol(s) not found

collect2: ld returned 1 exit status


Solution:
Most likely, the error is caused because the Core Data Framework is not added to the project.

Right click Frameworks folder -> Add -> Existing Frameworks -> CoreData.framework.

Done. :)