Updated info below, in bold.
I went and changed one of the entities in the CoreData of my app. For all my entities I have them selected as "Manual" for Codegen
So I deleted all four files (for two entities), cleaned the build folder, regenerated the CoreData files with Editor -> Create NSManagedObject Subclass.
Now every time I run the app I get a fatalError in the following code in the AppDelegate:
lazy var persistentContainer: NSPersistentContainer = {
let container = NSPersistentContainer(name: “Invoice_Gen")
container.loadPersistentStores(completionHandler: { (storeDescription, error) in
if let error = error as NSError? {
fatalError("Unresolved error \(error), \(error.userInfo)")
}
})
return container
}()
The error code being
[error] error: addPersistentStoreWithType:configuration:URL:options:error: returned error NSCocoaErrorDomain (134140)
Even if I remove the files for the CoreData entities, and comment out anything related to them code wise, I will still get this crash.
If someone has any idea of whether I have to delete something else, or am whatever I would so appreciate it. This one has me more stumped than anything before it.
The change I made was to turn one of the entities' attribute from String to Int
When I changed it back, everything works. So from my research on Google there is something about the mapping model. But I can not find it at all.
So it appears that I was misunderstanding where the fault/error lied.
I had changed an attribute in CoreData from String to Int. Since I had no data yet, I assumed that the existing entity would be over written. That was not the case.
So essentially I just have to delete the app from any device I am running them on, then rebuild.