Contents

stopAccessingSecurityScopedResource()

In an app that adopts App Sandbox, revokes access to the resource pointed to by a security-scoped URL.

Declaration

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 CFURLStopAccessingSecurityScopedResource(_:) function.

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

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

See Also

Working with Bookmark Data