mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-11 20:00:30 +01:00
Entity classes not found from frameworks #112
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 @deanWombourne on GitHub (Dec 21, 2016).
Hi,
If I make a framework which uses CoreStore, then the entity classes aren't being found.The exception is being thrown from
DataStack.swift:484on the swift3_develop branch (commit23df460c35according to my pod file.lock)Playing around in the debugger, I get this:
However, I can get it to find the class if I go to my framework bundle directly, and remove the module prefix from the class.
Not sure how to fix this reliably, or where else in the library this issue might become apparent, sorry!
@deanWombourne commented on GitHub (Dec 21, 2016):
Hmmm, just to make this more interesting, I backed up one commit to where the classes were all in the same module, and I got exactly the same error.
I fixed it by getting Xcode to create the managed object subclasses automatically instead of manually. Then, the managedObjectClassName didn't contain the module prexfix, and NSClassFromString worked. I have absolutely no idea why.
@JohnEstropia commented on GitHub (Dec 26, 2016):
Hi, I am not sure you can get the same behavior from the llvm debugger as the modules loaded there are different from the ones in the swift file. Have you tried marking your classes as
@objcorpublic open?@deanWombourne commented on GitHub (Dec 29, 2016):
They're already
@objc public:(However, it seems to work if I don't select anything in the Module dropdown in Xcode (i.e. use the default Global namespace) instead of choosing 'Current Product Module'. The sum total of the change to xcdatamodel/contents is this:
First line works (i.e. class name is just
ClientEntity) but the second one fails (class name becomesTaskTimer.ClientEntity, which isn't found).I'm fine leaving them in the global namespace for this app and it's working great (ps I'm loving CoreStore ;) but it does mean that if I wanted to build a library with CoreStore I might run into trouble.
I'll keep playing around and see what other class I can find.
@JohnEstropia commented on GitHub (Dec 31, 2016):
You can also try to declare the module name explicitly in your xcdatamodel instead of
Current Product Module.I'll close this issue as this seems to be more of a model configuration mismatch than a CoreStore problem. Thanks for the feedback!