I'm using git with Xcode 8.1 and working on Core Data in Objective-C on several branches, each of which inherit from a common master branch on which MyProject.xcdatamodeld
was created.
The error I am receiving when running tests is caught "NSInternalConsistencyException", "+entityForName: could not locate an entity named 'MyManagedObject' in this model."
, which arises when calling -[NSEntityDescription insertNewObjectForEntityForName:inManagedObjectContext:]
and where MyManagedObject is a simple subclass of NSManagedObject.
This error arises after switching between branches, though seemingly not consistently as sometimes my tests run without error. I've ensured that my managed object context is not nil and have tried cleaning my project, cleaning my build folder, and deleting the Derived Data folder, but without success. I've remembered to delete the app from the simulator between builds (as each branch uses a different Core Data model), and I've checked all of my spellings and have not found any typos.
Please let me know what other information I can provide to help debug!