RE: Disabling Undo in Core Data
RE: Disabling Undo in Core Data
- Subject: RE: Disabling Undo in Core Data
- From: Squ Aire <email@hidden>
- Date: Sat, 1 Aug 2009 19:51:35 +0000
- Importance: Normal
In fact, the NSManagedObjectContextObjectsDidChangeNotification is working nicely for my purposes, given that it is indeed being sent!
So, solution 2) you seem to like. When I said "one day" I actually meant to say that I plan on supporting undo for some selected features in my app, especially if my users request them. So it's not something "far in the future" thing.
So how about this: a) Leave the Core Data undo manager running (so that the NSManagedObjectContextObjectsDidChangeNotification will be sent properly). b) Get rid of the Undo and Redo menu items. c) When I need undo/redo for a particular feature, just add the Undo and Redo menu items again but connect them not to the default stuff but my own thing--my own custom undo manager stuff.
Sounds good enough?
----------------------------------------
> From: email@hidden
> To: email@hidden
> Date: Sat, 1 Aug 2009 12:38:00 -0700
> Subject: Re: Disabling Undo in Core Data
>
>
> On 2009 Aug 01, at 05:11, Squ Aire wrote:
>
>> 1) disableUndoRegistration ...
>> NSManagedObjectContextObjectsDidChangeNotification will stop being
>> sent when the context changes!
>
> I'd call that a bug, at least in the documentation. It is implied in
> a roundabout way...
>
> "The notification is posted during processPendingChanges", and then if
> you look up -processPendingChanges, "causes changes to registered
> managed objects to be recorded with the undo manager."
>
> But if it's true that
> NSManagedObjectContextObjectsDidChangeNotification falls silent if
> undo is disabled, at least the documentation should so state.
>
> When I first started reading Core Data I thought that
> NSManagedObjectContextObjectsDidChangeNotification would be quite a
> useful and simpler "one stop" alternative to KVO, but then learned
> that it is quite limited. You've just discovered another limitation.
>
>> 2) Which brings me to the second option. Keep the undo stuff there
>> so that the NSManagedObjectContextObjectsDidChangeNotification will
>> properly be sent out, as I want. However, instead just get rid of
>> the Undo and Redo menu items.
>
> I'd say it's quite reliable!
>
>> might be an option, but might be a bad one in case I would one day
>> like to add undoing for some selected feature in my app.
>
> It is rarely a good decision in this business to not use an easy
> solution because of what you "might" want to do "one day". The world
> moves too fast.
>
> _______________________________________________
>
> 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
_________________________________________________________________
Share your memories online with anyone you want.
http://www.microsoft.com/middleeast/windows/windowslive/products/photos-share.aspx?tab=1_______________________________________________
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