Core Data: Begin+End Undo Group = Dirty Dot. Why?
Core Data: Begin+End Undo Group = Dirty Dot. Why?
- Subject: Core Data: Begin+End Undo Group = Dirty Dot. Why?
- From: Jerry Krinock <email@hidden>
- Date: Fri, 13 Nov 2009 18:53:56 -0800
I have discovered (one of?) the mysterious causes of a Core Data
document becoming "dirty" (red button in title bar gets black dot)
when no changes have been made to the store.
STEPS TO REPRODUCE:
* Mac OS 10.5.8 (haven't tested 10.6 yet)
* Download a fresh copy of Apple's DepartmentAndEmployees sample
project.
* Add this method implementation to the MyDocument class:
- (IBAction)dooDoo:(id)sender {
[[self undoManager] beginUndoGrouping] ;
[[self undoManager] endUndoGrouping] ;
}
* Declare dooDoo: in MyDocument.m
* Save all files.
* Open MyDocument.nib.
* Add a button in the window, title "DooDoo".
* Connect button to target MyDocument, action dooDoo:.
* Build and run. A new document appears. Its dirty dot is clean.
* Click the "Doodoo" button.
EXPECTED RESULT:
Nothing should happen.
ACTUAL RESULT:
The dirty dot becomes dirty.
Why would the dirty dot become dirty when no change was made to the
store? I don't see any logical reason for this.
In my real app, I often manually begin and end a "super undo group".
However, I don't know before it starts if any changes will be made to
the store. So, in order to avoid these false dirties, the only
workaround I can think of is to manually track changes (which,
fortunately, I'm already doing for other reasons), and later send a -
clearAllChanges if no changes occurred. Is there a less kludgey
workaround?
Thanks,
Jerry Krinock
_______________________________________________
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