Reputation: 7185
I have been working on an Xcode tutorial and cannot get around this problem.The tutorial is here
The error I am getting is:
+entityForName: could not locate an NSManagedObjectModel for entity name 'Contact''
at this line (I have changed destination to contact):
Contact *contact = (Contact *)[NSEntityDescription insertNewObjectForEntityForName:@"Contact" inManagedObjectContext:managedObjectContext];
I am pretty sure the problem is because I have not completed point number 11 as I am unsure how to do it using Xcode 4.3.2 and storyboards. Does anyone know?
Upvotes: 2
Views: 243
Reputation: 2670
You can pass the context to the next viewcontroller just like in Stephens answer. However, you must also remember to add the context property to you new viewcontrollers by adding
@property(nonatomic,retain) NSManagedObjectContext *context;
to your header file and
@synthesize context;
to your implementation file.
You can do the following to check if you get the context:
In your viewdidload:
if (context == nil)
{
context = [(YOURAppDelegate *)[[UIApplication sharedApplication] delegate] managedObjectContext];
}
If this doesn't help. Try resetting your simulator as it seems to bug a lot when you are messing around with Coredata.
I hope this helps!
Upvotes: 1
Reputation: 52565
Assuming that the entitiy exists, it seems more likely that you're missing the following like from point number ten:
enterDataViewController.managedObjectContext = self.managedObjectContext;
Either that or your managedObjectContext is not set up correctly in the app delegate.
Upvotes: 0