Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cocoa NSDocument: getting autosave to work

Documentation simply states that setting setAutosavingDelay to anything > 0 on the shared doc controller should do it, but after calling

[[NSDocumentController sharedDocumentController] setAutosavingDelay:2.0];

in my controller, autosave doesn't seem to work: I neither see anything in ~/Library/Autosave Information/, nor is

[[[NSDocumentController sharedDocumentController] currentDocument] autosavedContentsFileURL]

initialized.

Note that in my app, normal loading and saving work fine (keyedarchivers, nscoding-based class for my docs, etc).

like image 582
taco Avatar asked Jan 02 '09 22:01

taco


1 Answers

Have you overridden -updateChangeCount: at all? I'm pretty certain that Apple's implementation is the code that starts up the autosave timer. Also, what if you experiment with a longer timer?

like image 147
Mike Abdullah Avatar answered Oct 01 '22 11:10

Mike Abdullah