Instance Method

URLsForDirectory:inDomains:

Returns an array of URLs for the specified common directory in the requested domains.

Declaration

- (NSArray<NSURL *> *)URLsForDirectory:(NSSearchPathDirectory)directory inDomains:(NSSearchPathDomainMask)domainMask;

Parameters

directory

The search path directory. The supported values are described in NSSearchPathDirectory.

domainMask

The file system domain to search. The value for this parameter is one or more of the constants described in NSSearchPathDomainMask.

Return Value

An array of NSURL objects identifying the requested directories. The directories are ordered according to the order of the domain mask constants, with items in the user domain first and items in the system domain last.

Discussion

This method is intended to locate known and common directories in the system. For example, setting the directory to NSApplicationDirectory, will return the Applications directories in the requested domain. There are a number of common directories available in the NSSearchPathDirectory, including: NSDesktopDirectory, NSApplicationSupportDirectory, and many more.

See Also

Locating System Directories

- URLForDirectory:inDomain:appropriateForURL:create:error:

Locates and optionally creates the specified common directory in a domain.

NSSearchPathForDirectoriesInDomains

Creates a list of directory search paths.

NSOpenStepRootDirectory

Returns the root directory of the user’s system.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software