Re: NSDocument -canCloseDocumentWithDelegate::: not called when terminating
Re: NSDocument -canCloseDocumentWithDelegate::: not called when terminating
- Subject: Re: NSDocument -canCloseDocumentWithDelegate::: not called when terminating
- From: Fritz Anderson <email@hidden>
- Date: Mon, 23 Jul 2012 10:42:08 -0500
Perhaps I'm missing something — is writing the preferences file very time-consuming? If not, why not write it whether you need to or not? Or whenever a preferences value changes, which is what you'd do with NSUserDefaults?
— F
On 23 Jul 2012, at 10:12 AM, Markus Spoettl wrote:
> My document is stored in a package that contains a preferences file. When the document is saved, the preferences file is saved as part of the package. So, if it is dirty at the time of closing it's going to be saved. If the document isn't dirty, I'd like to update the preference file only.
>
> A good place would have been -canCloseDocumentWithDelegate::: because I can check whether the document is dirty and save the preferences file if necessary. That doesn't work if it's not getting called of course. -close is called after the document is saved, so the dirty flag there isn't helpful.
>
> Are there better options to do a last-minute save? I do not want to change the design, meaning I don't want preferences to contribute to the change count state or even worse be undoable. Plus I do want the preferences to be stored in the package, not someplace else (restoration state for example).
--
Fritz Anderson -- Xcode 4 Unleashed: Now in stores! -- <http://x4u.manoverboard.org/>
_______________________________________________
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