Type Method


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


+ (BOOL)writeBookmarkData:(NSData *)bookmarkData toURL:(NSURL *)bookmarkFileURL options:(NSURLBookmarkFileCreationOptions)options error:(NSError * _Nullable *)error;



The bookmark data containing information for the alias file.


The desired location of the alias file.


Options taken into account when creating the alias file.


The error that occurred in the case that the alias file cannot be created.

Return Value

YES if the alias file is successfully created; otherwise, NO.


This method will produce an error if bookmarkData was not created with the NSURLBookmarkCreationSuitableForBookmarkFile option.

If bookmarkFileURL points to a directory, the alias file will be created in that directory with its name derived from the information in bookmarkData. If bookmarkFileURL points to a file, the alias file will be created with the location and name indicated by bookmarkFileURL, and its extension will be changed to .alias if it is not already.

See Also

Working with Bookmark Data

+ bookmarkDataWithContentsOfURL:error:

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

- 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.

- 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.


Options used when creating file bookmark data


Options used when creating bookmark data.


Options used when resolving bookmark data.