Re: customizing save behavior in doc based apps
Re: customizing save behavior in doc based apps
- Subject: Re: customizing save behavior in doc based apps
- From: Jim Correia <email@hidden>
- Date: Mon, 26 Dec 2005 16:08:56 -0500
On Dec 26, 2005, at 3:46 PM, email@hidden wrote:
So this leads me to believe that isDocumentEdited must not the the
best place to save the context after every edit?
I would have to say it is not. (BTW, I think your original
suppositions are wrong for an app that presents itself to the user as
a document based app, but if you insist on building it that way...)
What you are doing is introducing an unexpected side effect to
isDocumentEdited - it causes things to be written to disk. That is
similar to me saying "Matthew, does the lawn need mowing?" and in
response you go out and fertilize the lawn (even if you just did!)
before telling me "No, it doesn't need mowing."
Worse, you are relying on the fact that after you make a change,
someone will eventually send -isDocumentEdited to the document so you
can save that change. While it may be true in practice, they are two
unrelated things.
If you really want to save after every set of changes, listen to the
notifications designed for that purpose. An override of -
updateChangeCount: or listening for
NSManagedObjectContextObjectsDidChangeNotification both seem like
more appropriate solutions.
Jim
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden