• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: customizing save behavior in doc based apps
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • Re: customizing save behavior in doc based apps
      • From: Uli Kusterer <email@hidden>
References: 
 >customizing save behavior in doc based apps (From: Matthew Russell <email@hidden>)
 >Re: customizing save behavior in doc based apps (From: mmalcolm crawford <email@hidden>)
 >Re: customizing save behavior in doc based apps (From: email@hidden)

  • Prev by Date: Re: customizing save behavior in doc based apps
  • Next by Date: NSSlider Cell drawing artifacts
  • Previous by thread: Re: customizing save behavior in doc based apps
  • Next by thread: Re: customizing save behavior in doc based apps
  • Index(es):
    • Date
    • Thread