I have a model file thats named \"Model\". If I rename it to \"SomeOtherName\" it just does not get loaded.
initWithContentsOfURL
returns nil and:
The most likely cause is that new name is not being included in the build target. Check the target for included files and make sure the new name is there. If not, add it. If the old file name is there remove it before adding the new one.
If it is in the build target, confirm that the new file retains the .xcdatamodel
extension. Check the built product bundle to confirm that it includes a .mom
or .momd
file with the new name.
Your mergedModelFromBundles: should look like:
NSManagedObjectModel *mom=[NSManagedObjectModel mergedModelFromBundles:[NSArray arrayWithObject:[NSBundle mainBundle]];
... or:
NSManagedObjectModel *mom=[NSManagedObjectModel mergedModelFromBundles:[NSArray arrayWithObjects:[NSBundle mainBundle],nil] ];