Re: core data + undo + to-many relationship
Re: core data + undo + to-many relationship
- Subject: Re: core data + undo + to-many relationship
- From: John Clayton <email@hidden>
- Date: Sun, 07 Dec 2008 13:28:47 +0100
Actually, extra note here...
Things would probably work OK in my code if the object's values hadn't
been set to nil by the time I get a willTurnIntoFault message. Is
there a way to be notified prior to the event taking place?
Thanks
--
John Clayton
Skype: johncclayton
On 7/12/2008, at 1:13 PM, John Clayton wrote:
OK, I can understand that its more efficient - and have now seen my
error (I think).
The listener to the remove event is getting fired (via KVO), but all
of the data on the core-data Effect instances is nil, so my code
discards the event. I've got my own uniqueID value set up on the
Effect, because I wanted to totally avoid any ID changes that
occurred on the Effect object when it was saved (ie. model ID
changes from a temp to a permanent id).
Couple of questions:
a) why are all the values nil on my core-data object
b) can I force the objectID to be some permanent value - instead of
having it change on me? I need to track the Effect in a dictionary
- which is why I'm after some kind of stable key that I can use for
the lookup (normally I'd say the instance ptr is OK, but in core-
data two instances could point to the same data - theoretically).
Thanks
--
John Clayton
Skype: johncclayton
On 7/12/2008, at 12:48 PM, Mike Abdullah wrote:
Core Data is specifically designed not to invoke accessor methods
when undoing or redoing changes. For efficiency, it just rolls back
the state of the objects. It does NOT perform the reverse of your
original actions. Of course, during an undo/redo, KVO notifications
are fired, so your UI should be watching out for those in order to
update itself.
Mike.
On 7 Dec 2008, at 11:42, John Clayton wrote:
Hi everyone
In a core-data model I have a 'layer' which contains a to-many
relationship to a set of 'effects'. When I add an effect,
everything is working well.
When I use Ctrl-Z to have the undo manager undo the addition of
the effect, then none of my custom accessors are fired (so my GUI
doesn't react) - although the Effect instance faults and is
deallocated (as I can see from my logging).
I thought implementing the accessors: addEffectObject: /
removeEffectObject: and the set variations addEffects: /
removeEffects: on my Layer core-data class was enough to get the
undo management to work in this case - or did I misread the core-
data docs?
Any hints / tips appreciated.
Thanks
--
John Clayton
Skype: johncclayton
_______________________________________________
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
_______________________________________________
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:
@mac.com
This email sent to email@hidden
_______________________________________________
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