Sets the attributes of the specified file or directory.
- iOS 2.0+
- macOS 10.5+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
A dictionary containing as keys the attributes to set for
pathand as values the corresponding value for the attribute. You can set the following attributes:
Group Owner Account ID
Group Owner Account Name
Owner Account ID
Owner Account Name
NSFile. You can change single attributes or any combination of attributes; you need not specify keys for all attributes.
The path of a file or directory.
On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify
nilfor this parameter if you do not want the error information.
YES if all changes succeed. If any change fails, returns
NO, but it is undefined whether any changes actually occurred.
As in the POSIX standard, the app either must own the file or directory or must be running as superuser for attribute changes to take effect. The method attempts to make all changes specified in attributes and ignores any rejection of an attempted modification. If the last component of the path is a symbolic link it is traversed.
NSFile value must be initialized with the code representing the POSIX file-permissions bit pattern.
NSFile will only be heeded when
path specifies a file.