Instance Method

scheduleAutosaving

Schedules periodic autosaving for the purpose of crash protection.

Declaration

- (void)scheduleAutosaving;

Discussion

The default implementation of this method checks to see if autosaving is turned on and, if so and if [self hasUnautosavedChanges] returns YES, schedules an NSTimer to invoke autosaveDocumentWithDelegate:didAutosaveSelector:contextInfo: in the future. If [self hasUnautosavedChanges] returns NO it unschedules any previously scheduled timer. It takes care not to cause autosaveDocumentWithDelegate:didAutosaveSelector:contextInfo: to be invoked before a previous invocation caused by it has finished. The exact timings it uses are complicated and subject to change in future releases of macOS. You can override this method to control when exactly periodic autosaving happens. It is invoked by updateChangeCount: and updateChangeCountWithToken:forSaveOperation:.

See Also

Autosaving

- checkAutosavingSafetyAndReturnError:

Returns a Boolean value indicating whether it is probably safe to autosave document changes.

hasUnautosavedChanges

A Boolean value indicating whether the document has changes that have not been autosaved.

- autosaveDocumentWithDelegate:didAutosaveSelector:contextInfo:

Autosaves the document’s contents at an appropriate location.

- autosaveWithImplicitCancellability:completionHandler:

Autosaves the document’s contents at an appropriate location if it needs autosaving.

autosavesInPlace

Returns whether the receiver supports autosaving in place.

autosavesDrafts

Returns whether the receiving subclass of NSDocument supports autosaving of drafts.

preservesVersions

Returns whether the receiving subclass of NSDocument supports Versions.

- browseDocumentVersions:

Opens the Versions browser in the document’s main window.

autosavingFileType

Returns the document type that should be used for an autosave operation.

autosavingIsImplicitlyCancellable

A Boolean value indicating whether autosaving is happening now but could be safely cancelled.

autosavedContentsFileURL

The location of the most recently autosaved document contents.