Core Data life cycle, how to do setup that works with undo in an NSManagedObject?
Core Data life cycle, how to do setup that works with undo in an NSManagedObject?
- Subject: Core Data life cycle, how to do setup that works with undo in an NSManagedObject?
- From: Brian Williams <email@hidden>
- Date: Wed, 17 Jan 2007 10:41:17 -0800 (PST)
After reading all the documentation on Core Data that I can find, (BTW it would
be great if there was a book covering the subject) I can't figure out the
proper way to setup an observer in my NSManagedObject subclass. What I am
trying to do is have one NSManagedObject observe another. So lets say I have a
screen NSMO that has a relationship to a bunch of graphic NSMOs. When a graphic
is moved or a property is changed I want the screen to get a notification.
The documentation and the corerecipes use a commonAwake method for setup and
override didTurnIntoFault for tear down. This is all well and good, however it
doesn't work with undo. When adding a graphic to a screen in the above example,
the graphic is created the common awake is called the observer is added and
the graphic is added the screen. When you undo this actions didTurnIntoFault is
called and the observer is removed. Upon redo however the commonAwake is not
called and the observer is not re-added.
How should I deal with this? Do I need to not use observers at all in my code?
Is there some other setup method that I could use? Should Core Data come with a
warning in big red letters "DO NOT USE OBSERVERS WITH MANAGED OBJECTS" ?
Thanks in advance for any sagely advice coming my way :)
Brian
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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