Re: Temporarily disabling autosave
Re: Temporarily disabling autosave
- Subject: Re: Temporarily disabling autosave
- From: Mike Abdullah <email@hidden>
- Date: Tue, 23 Apr 2013 09:47:51 +0100
On 22 Apr 2013, at 23:57, Jerry Krinock <email@hidden> wrote:
>
> On 2013 Apr 22, at 09:43, Steve Mills <email@hidden> wrote:
>
>> So to sum up, upon pausing autosave
>
> which, per previous messages in this thread, I presume you do by sending the shared document controller -setAutosavingDelay:0.0. I'm surprised that this has any effect, because this method is "Available in OS X v10.4 and later", and is apparently part of the the old "Tiger" autosave mechanism.
>
> But, OK. It's not marked as deprecated. Apparently Apple has tweaked this method to work for both the old "Tiger" autosave and the new "Lion" autosave. Surprising.
>
>> I explicitly tell it to autosave if needed via autosaveWithImplicitCancellability, in writeToURL return NO and set a userCancelled error if autosave is paused, and in hasUnautosavedChanges return NO if autosave is paused. This seems to handle all the cases I've tested so far.
>
> You should try each of these three tests while autosave has been *paused*.
>
> • Activate another app.
> • Close the document window.
> • Quit the app.
>
> Debug -[NSDocument autosaveWithImplicitCancellability:completionHandler:] during this test. If this message is received, examine the implicitlyCancellable parameter and see if it is NO. Receiving that message with parameter NO is the most difficult case you need to handle, or else convince yourself that it can't happen.
Receiving a NO *is* going to happen. In particular, in the last of the two scenarios you've listed to test. If the document system says a save isn't cancellable, believe it!
_______________________________________________
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