What is Cocoa error 134140

This error can happen if you have several Core Data Model Versions and no Mapping Model. In a nutshell Core Data is telling you that it cannot infer your changes automatically when you add these options to the NSPersistentStoreCoordinator:

NSDictionary *options = @{NSSQLitePragmasOption: @{@"journal_mode": @"delete"},
                              NSMigratePersistentStoresAutomaticallyOption:@YES,
                              NSInferMappingModelAutomaticallyOption:@YES};
    
NSError *error = nil;
_persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];
if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:options error:&error] {
    // oh dear...
}

If you get this error you need to provide a Core Data Mapping Model. Note that in Xocde 4.x said file must for heavens sake not be in a group or subfolder, otherwise the universe as we know it will seize to exist.





Leave a Reply