I've been banging my head against this for too long. I have two ViewControllers trying to use NSEntityDescription, one can and one can't (giving me the above error).
Both ViewControllers import AppDelegate.h
I figure that it has to be a problem with the ManagedObjectContext but both ViewControllers set the ManagedObjectContext in ViewDidLoad the same way:
if (!self.managedObjectContext) {
self.managedObjectContext = [(AppDelegate *)[[UIApplication sharedApplication] delegate] managedObjectContext];
}
Maybe it has to do with the view controller hierarchy? Tho, I'm under the assumption that the use of NSEntityDescription is based upon the managedObjectContext.
Thanks!
I typically add #import <CoreData/CoreData.h>
to my Prefix.pch to ensure that it's available to all classes. It sounds like you forgot to import the Core Data headers in one of the view controllers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With