mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-13 15:13:28 +01:00
Standalone "mom" models are not detected in the bundle #89
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @andriichernenko on GitHub (Oct 5, 2016).
Extension of the compiled CoreData model file CoreStore tries to find on initialization is hardcoded as
momd(seeNSManagedObjectModel+Setup.swift):However, in some cases the model file has extension
mom, which means that CoreStore is unable to find the model and fails.@JohnEstropia commented on GitHub (Oct 6, 2016):
Hi
The
momdandmomfiles are different things. The momd file is actually a container that contains all version models, and each model version data are in their respective mom files. See the lower part of theNSManagedObjectModel+Setup.swift'sfromBundle(...)method:This part iterates all mom files from inside the momd directory.
@JohnEstropia commented on GitHub (Oct 6, 2016):
@deville Just to make sure, are you actually seeing a case where the
.momfiles are outside the.momddirectory? If so, please tell which iOS version you are seeing this and if you have any idea how the file structure was changed.@andriichernenko commented on GitHub (Oct 6, 2016):
@JohnEstropia Yes, I actually had a
momfile outside themomd.I am using the latest versions of Xcode and iOS. The model files Xcode 8 creates have extension
xcdatamodeldand they get compiled intomomd. However, I copied the model from an old project, and it had extensionxcdatamodelwhich was compiled intomom. So that's how I ended up with a separatemomfile in the bundle.@JohnEstropia commented on GitHub (Oct 6, 2016):
I think you should fix that on your side. I'm guessing you copied only the contents of your old xcdatamodeld without creating a new xcdatamodeld on your new project. You should put the xcdatamodel in a proper modeld container because versioning in Core Data (not necessarily CoreStore) is managed within that container.
@andriichernenko commented on GitHub (Oct 6, 2016):
@JohnEstropia Well, yes, I have fixed this, so no problem here.
No, that's not the case, the
xcdatamodelfile I copied was not insidexcdatamodeld.Since new Xcode versions always create models in container, I guess there's no point in modifying the existing model detection behavior. But maybe it would be nice to mention this somewhere in the docs, just in case somebody else runs into this.
@JohnEstropia commented on GitHub (Oct 6, 2016):
Okay, thanks. I wasn't familiar that older Xcode versions allowed creation of standalone
xcdatamodels. Will see how to incorporate this in the README (although I feel theres a whole bunch of legacy behavior that CoreStore doesn't handle in the first place)