Been having my first crack at Core Data and I\'m getting the following error when running my code on my device, but it works fine on the simulator..
*
I've experienced a weird issue with Xcode 4.3.2 and iOS 5.
NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"NAME_OF_THE_MODEL" withExtension:@"momd"];
returns a valid URL but
__managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL];
returns a null NSManagedObjectModel. But after checking the documentation, it seems like NSManagedObjectModel needs a file where as NAME_OF_THE_MODEL.momd is a directory which contains a NAME_OF_THE_MODEL.mom file. Changing the URL to
NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"NAME_OF_THE_MODEL" withExtension:@"mom" subdirectory:@"NAME_OF_THE_MODEL.momd"];
then works. Seems weird though that Xcode generates code that doesn't work with itself...