No you cannot change the current version. But you also do not need to.
- You can create a model programmatically as suggested by @Adam.
- You can choose which model you wish to use with the
-initWithContentsOfURL:
method onNSManagedObjectModel
.
Loading the current version is just a migration convenience and is not required.
Update
Thank you for answer. And i have a qustion. if i want to chose the current version by some cases, copy original xcdatamodeld file and put two xcdatamodeld files in project, original xcdatamodeld is set current version and copied xcdatamodeld is set another version, And i chose these files by initWithContentsOfURL method. Is this way possible?
That is possible but unnecessary. When you point the -initWithContentsOfURL
to your momd
it will choose the most recent version of the model automatically. If you point it at a mom
file it will load a single model. Since the mom
files are inside of the momd
directory, you can keep just one versioned model and then load whatever version of that model you want. I do this quite frequently when I am doing all of the migration manually.
A mom
is a xcdatamodel
file compiled. A momd
is a directory of compiled models and is the result of compiling a xcdatamodeld
bundle (aka folder).