I've lost my ManagedObjectModel
I've been playing with XCode4 and seem to have gotten myself in a bit of trouble. I was trying to organize my project on disk to be prettier and better reflect the groups I had set up but I have apparently broken my xcdatamodel. When I moved it out of the root of my project it started giving me an error saying Failed to open persistent store, so I put everything back as it was. Everything worked. As I have played with my project and changed and moved things, it seems to have not recovered as expected and now fails on thes开发者_如何学编程e lines:
NSManagedObjectModel *mom = [self managedObjectModel];
if (!mom) {
NSLog(@"%@:%@ No model to generate a store from", [self class], NSStringFromSelector(_cmd));
return nil;
}
Most of the code is stock and I do not care about versioning or preserving data. I just want it to be able to create a new data store again. Does anyone have any clues as to what I have missed.
Thanks,
Tom
Assuming your model is back to the root directory, try to clean your project (using XCode's Clean All menu item). If that doesn't work then you might have to rebuild your model, or as a last resort, start a new project and copy things over as you need them (Do this in XCode, NOT in Finder).
As a general rule do not move files on disk. Let XCode handle the organization otherwise you will confuse it.
精彩评论