• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Core data storage of objects whose class is loaded from a bundle
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Core data storage of objects whose class is loaded from a bundle


  • Subject: Core data storage of objects whose class is loaded from a bundle
  • From: Rick Hoge <email@hidden>
  • Date: Thu, 29 Jan 2009 15:28:58 -0500


I am working on an app in which plugin subclasses are loaded from bundles at launch time (didFinishLaunching in app delegate). The base plugin class is specified in a framework against which the main app is linked.


I can create instances of these dynamically loaded subclasses, and assign them as 'transformable' attributes belonging to Core Data entities. During a session the object behaves as expected, and I am able to save the core data store to disk (the plugin base class and dynamicaly loaded subclasses conform to the NSCoding protocol).

However when I reload the core data store (i.e. quit the app and open the persistent document again), it seems that Core Data is unarchiving the coded objects as instances of the base plugin class and not the subclass that was (and is again) dynamically loaded. I was hoping that the correct subclass would have been used since the plugins have already been loaded by the app *before* I unarchive the document.

I realize that this approach may be 'playing with fire' since weird things will surely happen if some plugins aren't available when the store is re-opened in the future (although this can be handled gracefully I think). I also realize I can just make such attributes 'transient' and manage creation and reloading of the store myself. However it's certainly nice when Core Data does all this stuff for you... I'd hate to introduce complexity just because I was missing something obvious about how to load these attributes.

So I was wondering: does anyone know a way to force the correct class to be used when reloading such an attribute?

Thanks in advance,

Rick




_______________________________________________

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


  • Follow-Ups:
    • Re: [Solved - duh!] Core data storage of objects whose class is loaded from a bundle
      • From: Rick Hoge <email@hidden>
  • Prev by Date: Re: Plain Text UTI Madness
  • Next by Date: Re: Sub-pixel font smoothing with CGBitmapContext
  • Previous by thread: Re: NSTask Leaking...
  • Next by thread: Re: [Solved - duh!] Core data storage of objects whose class is loaded from a bundle
  • Index(es):
    • Date
    • Thread