• 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
Manually trigger autosave
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Manually trigger autosave


  • Subject: Manually trigger autosave
  • From: Eberhard Rensch <email@hidden>
  • Date: Fri, 22 Sep 2006 17:04:23 +0200

Hello all,

in my application I'm using the NSDocument feature to autosave the document (setAutosavingDelay: set to >0). This works fine so far.

To maximize the safety for the documents contents, I need to trigger autosave manually at two places in the application (that means triggered by some user action, not by the internal NSDocument- Autosave-Timer).

So I've inserted calls to autosaveDocumentWithDelegate:didAutosaveSelector:contextInfo: (NSDocument) at the two critical places into the application.

Now I have the weird behaviour that the application autosaves the document as expected but when I terminate ("crash") and restart the app it reloads the autosaved state only when the autosave was triggered from the internal NSDocument-Autosave-Timer or from one of the two manual autosaveDocumentWithDelegate:... calls.

The weird thing is that the "Docname (Autosaved).ext" document file and the "com.mycompany.yadayada.plist" in "~/Library/Autosave Information/" are always created.

I've checked the "Docname (Autosaved).ext" file and it contained always the correct, newest state of the document.
I've also checked the autosave information file and it seemed to be exactly the same each time (besides the different modificationDate).


When the autosave was triggered by the internal timer or the one call of autosaveDocumentWithDelegate:... all works fine and after the simulated "crash", the application automatically opens the recently autosaved state of the document.

When the autosave was triggered by other call of autosaveDocumentWithDelegate:... the application deletes the files "Docname (Autosaved).ext" and "~/Library/Autosave Information/ com.mycompany.yadayada.plist" and just creates a new empty document.


Are there any other files or settings causing the automatic reload of an autosaved document than the "...(Autosaved).ext" file and the autosave information plist???


What might be the reason for the different behaviour of my two autosaveDocumentWithDelegate calls?
I've already tried to call [document updateChangeCount:NSChangeDone] before calling autosaveDocumentWithDelegate, but this doesn't help.


Any suggestions?

Thanks
Eberhard
_______________________________________________
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


  • Prev by Date: Re: How much does NSObject's bind:toObject:withKeyPath:options: do?
  • Next by Date: Re: strange compiler error
  • Previous by thread: Re: Daemon / Server startup issues. Help experts!!
  • Next by thread: Re: strange compiler error
  • Index(es):
    • Date
    • Thread