0

I am learning to work with core data. But why did I get such an error?

Error Image

My Core Data Codes

My Core Data Settings

edit: the problem was due to my renaming "Entity". It's fixed

  • Did you read the error reason in the first screenshot (-> *missing mapping model*)? It’s pretty clear. – vadian Feb 18 '22 at 14:32
  • I'm just learning but I still don't understand what is missing? – Tuğberk Can Özen Feb 18 '22 at 14:50
  • If it is just a test [`destroy` the store](https://stackoverflow.com/questions/70482430/mock-core-data-object-in-swiftui-preview/70482536#70482536) you made a change to the model file without creating a new model version. This action is permanent everything will be gone. – lorem ipsum Feb 18 '22 at 15:15

1 Answers1

1

You might have changed the Core Data model (names or types of the attributes) after populating it with some data. XCode could not be able to migrate the existing data from the old model to the new one.

You can try re-creating the model from scratch (deleting the whole Entity) if you don’t mind losing the existing data.

HunterLion
  • 3,496
  • 1
  • 6
  • 18