Instance Method

lockDocumentWithCompletionHandler:

Prevents the user from making further changes to the document.

Declaration

- (void)lockDocumentWithCompletionHandler:(void (^)(BOOL didLock))completionHandler;

Parameters

completionHandler

The completion handler block object passed in to be invoked after locking is completed, regardless of success or failure of locking.

Discussion

By default, this method first ensures that any editor who has registered using Cocoa Binding’s NSEditorRegistration informal protocol has committed all changes and then autosaves the document, if necessary, before attempting to lock it using the lockWithCompletionHandler: method. Upon successful locking, the locked property is set to [YES]. Documents whose fileURL property is set to nil cannot be locked.

See Also

Locking Documents

- lockDocument:

Locks the document in response to the user choosing the Lock menu item.

- unlockDocument:

Unlocks the document in response to the user choosing the Unlock menu item.

- lockWithCompletionHandler:

Prevents further modifications from being made to the file.

- unlockDocumentWithCompletionHandler:

Allows the user to make modifications to the document.

- unlockWithCompletionHandler:

Allows the user to make modifications to the file.

locked

A Boolean value indicating whether or not the file can be written to.