Dynamically Loading Code and Core Data Non-Standard Persistent Attributes
Dynamically Loading Code and Core Data Non-Standard Persistent Attributes
- Subject: Dynamically Loading Code and Core Data Non-Standard Persistent Attributes
- From: "Carter R. Harrison" <email@hidden>
- Date: Tue, 05 Apr 2011 18:36:07 -0400
My Core Data application has a plugin architecture. Plugins reside within their own bundles and of course are loaded dynamically at runtime. I intend to encode instances of each plugin bundle's principal class just as Apple describes it in the section of the Core Data Programming Guide called "Non-Standard Persistent Attributes". In this section it explains that you should create an attribute of type "Transformable" within your entity. This particular attribute is encoded and decoded using NSKeyedArchiving. So the instances of my plugins archive correctly, but when I relaunch the application and Core Data tries to unarchive them I receive an exception like:
*** -[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class (DiskSpaceAlert)
I can't tell exactly why this is happening. My plugin class implements the NSCoding protocol. I'm thinking that it's happening because at the time of unarchiving, my plugin's bundle has not been loaded and thus the NSKeyedArchiver can't find my class (DiskSpaceAlert in this case). So I added code to dynamically load all of my plugin bundles prior to the point where they are unarchived but this hasn't fixed anything.
Can anybody help me out? Thank you in advance.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden