<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 8.0.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/URL/stopAccessingSecurityScopedResource()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation3URLV35stopAccessingSecurityScopedResourceyyF"
  },
  "title" : "stopAccessingSecurityScopedResource()"
}
-->

# stopAccessingSecurityScopedResource()

Revokes the access granted to the url by a prior successful call to the complementary start function.

```
func stopAccessingSecurityScopedResource()
```

## Discussion

When you no longer need access to a file or directory pointed to by a security-scoped URL, such as one returned by resolving a security-scoped bookmark, call this method on the URL to relinquish access. You can also use its Core Foundation equivalent, the <doc://com.apple.documentation/documentation/CoreFoundation/CFURLStopAccessingSecurityScopedResource(_:)> function.

You must balance each call to [`startAccessingSecurityScopedResource()`](/documentation/Foundation/URL/startAccessingSecurityScopedResource()) for a given security-scoped URL with a call to [`stopAccessingSecurityScopedResource()`](/documentation/Foundation/URL/stopAccessingSecurityScopedResource()). When you make the last balanced call to [`stopAccessingSecurityScopedResource()`](/documentation/Foundation/URL/stopAccessingSecurityScopedResource()), you immediately lose access to the resource in question.

> Warning:
> If you fail to relinquish your access to file-system resources when you no longer need them, your app leaks kernel resources. If sufficient kernel resources leak, your app loses its ability to add file-system locations to its sandbox, such as with Powerbox or security-scoped bookmarks, until relaunched.

If you call this method on a URL whose referenced resource you don’t have access to, nothing happens.

> Version note:
> Security-scoped bookmarks aren’t available in versions of macOS prior to OS X 10.7.3.

---

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)