Re: problem with core data and uno
Re: problem with core data and uno
- Subject: Re: problem with core data and uno
- From: Mike Abdullah <email@hidden>
- Date: Tue, 7 Dec 2010 10:25:01 +0000
This is the correct behaviour (at least from Core Data's perspective). Undoing registration effectively amends changes onto the previous change. It doesn't remove the changes entirely from Core Data's notice.
On 6 Dec 2010, at 19:40, email@hidden wrote:
> i'm having a problem with core data and undo. here is the simplified situation. i've got subclasses of NSManagedObject: object A and object B. object A has a to-one relationship to object B. the reciprocal relationship in object B is a to many relationship. i.e., object B can refer to multiple object A s, but object A can only reference one object B. i then edit object A (using a sheet to enable editing multiple properties simultaneously) to refer to a different object B. this is an undoable user action. later on i programmatically change one of the properties of object B. this is NOT undoable, and the change is done as follows:
>
> [moc processPendingChanges];
> [[moc undoManager] disableUndoRegistration];
>
> b.propertyB = blah;
> ...
>
> [moc processPendingChanges];
> [[moc undoManager] enableUndoRegistration];
>
> now if i subsequently undo the first set of edits to object A, propertyB of object B gets reverted back to the value it had prior to this entire sequence. this strikes me as wrong! while the first set of edits (to object A) did change the to many relationship that object B had, they did not touch the propertyB property and should not have reverted it.
>
> it seems to me that core data is saving the entire state of object B, instead of simply the state of the to many relationship.
>
> can anyone confirm my suspicions? or suggest that possibly this is a bug in my app -- i have spent about 12 hours trying to track this down in my app, and haven't found anything? or if my suspicions are correct, can anyone suggest a work-around? or is there some other way to do this?
>
> thanx,
> ken
> _______________________________________________
>
> 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:
This email sent to email@hidden