Re: Dynamically Loading Code and Core Data Non-Standard Persistent Attributes
Re: Dynamically Loading Code and Core Data Non-Standard Persistent Attributes
- Subject: Re: Dynamically Loading Code and Core Data Non-Standard Persistent Attributes
- From: Eli Bach <email@hidden>
- Date: Wed, 06 Apr 2011 00:17:18 -0600
On Apr 5, 2011, at 4:36 PM, Carter R. Harrison wrote:
> ...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.
Now, I haven't investigated doing this at all, but you may need to do an extra step after loading your plugins, and that would be to get the objective-c runtime to insert your classes into the in-memory runtime structures.
You may need to query the class by name or try to manually instantiate/delete an instance of each class in the plugin [say, by calling a function in each plugin to do so].
It may also depend on how you are loading your plugins, as in, if you load them using an objective-c API, it may add your classes to the runtime when the plugin loads whereas if you use unix plugin code, it wouldn't.
Eli
_______________________________________________
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