I'm getting an exception whilst trying to construct an NSMigrationManager instance. The init method is throwing an NSInternalInconsistencyException with an error message that reads 'Model already contains an entity named -Entity Name-'. I haven't been able to find anything that might help me spot a possible solution.
What I can see is that the entity that is mentioned on the error message inherits from a base entity. I can see that the hashes of these entities (entities inheriting from other entities) are different between the source and destination models even though the only change triggering the migration is that I added a new attribute to another entity. This makes me wonder whether this is an Apple's bug.
Any ideas? Possible workaround?
Stack trace below:
0 CoreFoundation 0x037081e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x034878e5 objc_exception_throw + 44
2 CoreData 0x015d01c3 -[NSManagedObjectModel(_NSManagedObjectModelPrivateMethods) _addEntity:] + 307
3 CoreData 0x015c9228 -[NSManagedObjectModel setEntities:] + 392
4 CoreData 0x015c88b1 -[NSManagedObjectModel copyWithZone:] + 657
5 libobjc.A.dylib 0x03499bcd -[NSObject copy] + 41
6 CoreData 0x015db685 -[NSMigrationManager initWithSourceModel:destinationModel:] + 101