can't find managed object model?
I created a entity called photo inmy .xcdatamodel.
but when I tried to add it into my context:
NSManagedObjectContext *context = [self managedObjectContext];
Photo *p = [NSEntityDescription insertNewObjectForEntityForName:@"Photo" inManagedObjectContext:context];
it had run-time error:
开发者_Go百科+entityForName: could not locate an NSManagedObjectModel for entity name 'Photo'
it's really weird, I included the Photo.h, generated by xcode coredata.
does anyone have an idea why it goes wrong?
I can't find what's wrong at all.. > <
Thanks!
Make sure your call to [self managedObjectContext]
is returning a valid context (and not nil). Also make sure you're using the proper case (you said your entity was called "photo" but you're trying to insert a new object for an entity named "Photo").
精彩评论