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. :)

3 comments:

  1. Thanks mate, i had solved this issue at work, and then three weeks later at home, i got the same problem while developing and app, and i had totally forgotten to add the framework.
    cheers

    ReplyDelete
  2. Genius. I was breaking my head with this. You saved me, man. Thanks a lot!

    ReplyDelete