Pergunta

I ran into my first Core Data versioning problem - learn something every day!

Following instructions found here, I made a new version of the model, added the code for lightweight migration, and then went to set the active version…

Uhhh, where do you do that? The docs don't actually say, and other threads here talk about "click on the main file". WHAT "main file"?

The original xcdatamodel has no version number in it. Is that a problem? Is the Migration Manager still going to be able to figure this out?

All I did was add a field, this seems like a lot of work…

Foi útil?

Solução

Core Data model files don't use version numbers. The files might include a number in their name, but that's for people to see, Core Data doesn't care about it. It uses entity hashes to compare models.

The "main file" is the .xcdatamodeld that contains all the versions (which have names ending in .xcdatamodel).

Data model versions

Select that then look in the file inspector pane on the right. It has a pop-up menu that you use to select the current version.

Selecting the current version

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top