core data, undo and redo
core data, undo and redo
- Subject: core data, undo and redo
- From: Martin Hewitson <email@hidden>
- Date: Sat, 22 May 2010 18:36:45 +0200
Dear list,
I'm trying to understand what happens regarding undo/redo when an item (NSManagedObject) is removed from a NSTreeController. In particular I have an NSManagedObject subclass which has properties which are not part of the core data model, but are instead (in some sense) transient. For example, one property is an NSTextStorage which I create in awakeFromFetch:. At the moment, I have to release the NSTextStorage just before I remove the item from the tree-controller. I rather expected (perhaps wrongly) that removing the item from the tree-controller (which is bound to the managed object context) would result in the particular NSManagedObject being released, but I don't see that happening. I also checked to see if didTurnIntoFault: is called on the item, but it isn't. My main problem is that, when I undo the removing of items from the tree, I need to reinstate the transient properties like the text storage. When I undo, awakeFromFetch: isn't called, neither is awakeFromInsert:. So where does one get the chance to 'handle things' after an undo? I saw in the documentation the method awakeFromSnapshotEvents: but there it says "Available in iPhone OS 3.0 and later". What about if I'm developing for 10.5?
Many thanks in advance for any insights that anyone can offer.
Best wishes,
Martin
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Martin Hewitson
Albert-Einstein-Institut
Max-Planck-Institut fuer
Gravitationsphysik und Universitaet Hannover
Callinstr. 38, 30167 Hannover, Germany
Tel: +49-511-762-17121, Fax: +49-511-762-5861
E-Mail: email@hidden
WWW: http://www.aei.mpg.de/~hewitson
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_______________________________________________
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