I am suddenly getting a bunch of warnings on iOS12/XCode 9. Why are there multiple managedObjectModels ? The app only has one *.xcdatamodeld file but there are multiple versions within the model.
Is this some new iOS12 Coredata feature and is there something I can do to prevent this warning or should I just ignore it?
2018-09-18 11:45:34.487073+1000 xxxxxxxxx[4422:1419983] [error] warning: 'Stats' (0x2812f1550) from NSManagedObjectModel (0x2806ff480) claims 'Stats'.
CoreData: warning: 'Stats' (0x2812f1550) from NSManagedObjectModel (0x2806ff480) claims 'Stats'.
2018-09-18 11:45:34.487084+1000 xxxxxxxxx[4422:1419983] [error] warning: 'Stats' (0x2812f3bd0) from NSManagedObjectModel (0x2806b18b0) claims 'Stats'.
CoreData: warning: 'Stats' (0x2812f3bd0) from NSManagedObjectModel (0x2806b18b0) claims 'Stats'.
If every time you want to access your persistent container you create an instance of NSPersistentContainer(name:), you will get this warning. I had this issue because I was using two different containers in my storage class(each container for a different managed object model). I solved it by keeping each container in a var property and whenever I change the persistent container, I re-assign it from the property without creating another instance like so:
And then when you init the container try to assign it to your variable
And the same thing with the second container.