<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.7.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSURL/startAccessingSecurityScopedResource()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSURL(im)startAccessingSecurityScopedResource"
  },
  "title" : "startAccessingSecurityScopedResource()"
}
-->

# startAccessingSecurityScopedResource()

In an app that has adopted App Sandbox, makes the resource pointed to by a security-scoped URL available to the app.

```
func startAccessingSecurityScopedResource() -> Bool
```

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the request to access the resource succeeded; otherwise, <doc://com.apple.documentation/documentation/Swift/false>.

## Discussion

When you obtain a security-scoped URL, such as by resolving a security-scoped bookmark, you can’t immediately use the resource it points to. To make the resource available to your app, by way of adding its location to your app’s sandbox, call this method on the security-scoped URL. You can also use Core Foundation equivalent, the <doc://com.apple.documentation/documentation/CoreFoundation/CFURLStartAccessingSecurityScopedResource(_:)> function.

If this method returns <doc://com.apple.documentation/documentation/Swift/true>, then you must relinquish access as soon as you finish using the resource. Call the [`stopAccessingSecurityScopedResource()`](/documentation/Foundation/NSURL/stopAccessingSecurityScopedResource()) method to relinquish access. You must balance each call to [`startAccessingSecurityScopedResource()`](/documentation/Foundation/NSURL/startAccessingSecurityScopedResource()) for a given security-scoped URL with a call to [`stopAccessingSecurityScopedResource()`](/documentation/Foundation/NSURL/stopAccessingSecurityScopedResource()). When you make the last balanced call to [`stopAccessingSecurityScopedResource()`](/documentation/Foundation/NSURL/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.

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

## See Also

[`URLByResolvingBookmarkData:options:relativeToURL:bookmarkDataIsStale:error:`](/documentation/Foundation/NSURL/URLByResolvingBookmarkData:options:relativeToURL:bookmarkDataIsStale:error:)

Returns a new URL made by resolving bookmark data.



---

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)