I have a today extension which uses the same model as the main app and I have had it working before, but now it no longer works.
I get the error * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Cannot create an NSPersistentStoreCoordinator with a nil model'
Things I have done:
Cleaned Build Folder and Cleaned project
Restarted Xcode
Restarted computer
Changed "momd" to "mom"
Ensured the model has the today extension check in the target membership
What else can I do?
- (NSManagedObjectModel *)managedObjectModel
{
if (_managedObjectModel != nil) {
return _managedObjectModel;
}
NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"Model" withExtension:@"momd"];
_managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL];
return _managedObjectModel;
}