0

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…

Maury Markowitz
  • 9,082
  • 11
  • 46
  • 98

1 Answers1

1

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

Tom Harrington
  • 69,312
  • 10
  • 146
  • 170
  • Ahhh, thanks Tom. So it seems I did something wrong then, because my new version is not "under" the main version. I DID use the "Add Model Version…" function in the Editor menu, so I'm a bit mystified what's going on now. Any ideas? – Maury Markowitz Mar 27 '14 at 21:43
  • Hmmm, I did the EXACT same thing, and now it created it under the original. Ummm, OK, it's working so… – Maury Markowitz Mar 27 '14 at 21:44