Type Method

bookmarkDataWithContentsOfURL:error:

Initializes and returns bookmark data derived from an alias file pointed to by a specified URL.

Declaration

+ (NSData *)bookmarkDataWithContentsOfURL:(NSURL *)bookmarkFileURL error:(NSError * _Nullable *)error;

Parameters

bookmarkFileURL

The URL that points to a file containing bookmark data.

error

The error that occurred in the case that the bookmark data cannot be derived.

Return Value

The bookmark data for the alias file.

Discussion

This method doesn’t check to see if bookmarkFileURL points to an alias file. This allows this method to work with any file containing bookmark data. If bookmarkFileURL refers to a file which does not contain bookmark data or to a non-file object, such as a directory or symbolic link, this method returns nil produces an error.

This method returns nil if bookmark data cannot be created.

See Also

Working with Bookmark Data

- bookmarkDataWithOptions:includingResourceValuesForKeys:relativeToURL:error:

Returns a bookmark for the URL, created with specified options and resource values.

+ resourceValuesForKeys:fromBookmarkData:

Returns the resource values for properties identified by a specified array of keys contained in specified bookmark data.

+ writeBookmarkData:toURL:options:error:

Creates an alias file on disk at a specified location with specified bookmark data.

- startAccessingSecurityScopedResource

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

- stopAccessingSecurityScopedResource

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

NSURLBookmarkFileCreationOptions

Options used when creating file bookmark data

NSURLBookmarkCreationOptions

Options used when creating bookmark data.

NSURLBookmarkResolutionOptions

Options used when resolving bookmark data.