<!--
{
  "availability" : [
    "macOS: 10.8.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSDocument/unlock(completionHandler:)-6m7rh",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSDocument(im)unlockWithCompletionHandler:"
  },
  "title" : "unlock(completionHandler:)"
}
-->

# unlock(completionHandler:)

Allows the user to make modifications to the document’s file.

```
func unlock(completionHandler: (((any Error)?) -> Void)? = nil)
```

## Parameters

`completionHandler`

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

## Discussion

By default, this method tries to clear the “user immutable” flag and, if necessary, add write permissions to the file itself.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)