Writes the data object's bytes to the location specified by a given URL.
- iOS 2.0+
- macOS 10.4+
- tvOS 9.0+
- watchOS 2.0+
- Mac Catalyst 13.0+Beta
The location to which to write the receiver's bytes.
A mask that specifies options for writing the data. Constant components are described in
If there is an error writing out the data, upon return contains an error object that describes the problem.
YES if the operation succeeds, otherwise
Since at present only
file:// URLs are supported, there is no difference between this method and
write, except for the type of the first argument.
This method may not be appropriate when writing to publicly accessible files. To securely write data to a public location, use
NSFile instead. For more information, seeSecuring File Operations in Secure Coding Guide.