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 protected])
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]