<!--
{
  "availability" : [
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSDistributedLock/unlock()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSDistributedLock(im)unlock"
  },
  "title" : "unlock()"
}
-->

# unlock()

Relinquishes the receiver.

```
func unlock()
```

## Discussion

You should generally use the [`unlock()`](/documentation/Foundation/NSDistributedLock/unlock()) method rather than [`break()`](/documentation/Foundation/NSDistributedLock/break()) to release a lock.

An `NSGenericException` is raised if the receiver doesn’t already exist.

---

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)