Locates and optionally creates the specified common directory in a domain.
- iOS 4.0+
- macOS 10.6+
- tvOS 9.0+
- watchOS 2.0+
The search path directory. The supported values are described in
Manager .Search Path Directory
The file URL used to determine the location of the returned URL. Only the volume of this parameter is used.
This parameter is ignored unless the
directoryparameter contains the value
Manager .Search Path Directory .item Replacement Directory
domainparameter contains the value
Whether to create the directory if it does not already exist.
When creating a temporary directory, this parameter is ignored and the directory is always created.
NSURL for the requested directory.
You typically use this method to locate one of the standard system directories, such as the
Application Support or
Caches directories. After locating (or creating) the desired directory, this method returns the URL for that directory. If more than one appropriate directory exists in the specified domain, this method returns only the first one it finds.
You can use this method to create a new temporary directory. To do so, specify
File for the
user for the
domain parameter, and a URL for the
url parameter which determines the volume of the returned URL.
For example, the following code results in a new temporary directory with a path in the form of