I’ve been working through the Marcus Zarra book “Core Data” and although it seems quite good, I’ve found a few things that could have been made a bit clearer. As with most any book, there are errors, you can find the errata for the Core Data book here: Core Data errata . But some things are not as clear as they could be for total novices to CD. As you follow the book through and build the sample projects (available here: Core Data source), you might find things don’t work as the book indicates they should.
I’m going to assume you can figure out the Cocoa related issues, but the CD issues may not be as straightforward. In particular, when running the second version of the second project, you may get the error: “missing source managed object model”. I only found a couple of references to this error when googling, but because there were so few, and I double and triple checked my code against the book, I assumed the problem must be me. As usual, it was. The simple answer is this: Don’t give your project the exact same name as Zarra does in his book, if you want to also run the projects included in the book’s source code. There is a hash generated when a Core Data project is run and it’s stored in the xml file in the Application Support folder. This hash is used when running a CD project and when migrating a CD data store to a new version. If you run Zarra’s code and the project has the same name, the hash will get changed. If you then attempt the second version of the project with this changed hash, you’ll get the title of this post as an error. If you do get the error, delete the xml file, run the first version of the project and recreate the data. Now you should be able to run the second version of the project and your data will be migrated as expected. I’m sure there are more details that I’m not aware of yet, but this should get you passed this error. I’ll continue to post as I work through the book, so feel free to check in from time to time.