'+entityForName: nil is not a legal NSPersistentStoreCoordinator for searching for entity name

1.3k views Asked by At

Getting the exception later in the program when _managedObjectModel is being used. Below is initialiser code.

 NSURL *modelURL = [[NSBundle mainBundle] URLForResource:self.managedObjectModelName withExtension:@"momd"];
_managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL];

The problem is that _managedObjectModel is pointing to a garbage memory location. After analysing GPR and assembly code i found that the ManagedObjectModel was being initialised properly but, when the content from schema is being loaded into it - the object pointer starts pointing at random locations way before the object is, or somewhere in between the object's allocated memory.

If i try to access underlying content using something like this : [_managedObjectModel->_entities allKeys], i do get all the keys in schema.

Has anyone ever faced such issues ?

This is probably something similar to https://github.com/typhoon-framework/Typhoon/issues/138

1

There are 1 answers

1
India On

self.managedObjectModelName is same as your data model name?

I guess some where here is problem in names itself.