Writes the data object's bytes to the location specified by a given URL.
- iOS 2.0+
- macOS 10.0+
- UIKit for Mac 13.0+Beta
- tvOS 9.0+
- watchOS 2.0+
The location to which to write the receiver's bytes. Only
file://URLs are supported.
true, the data is written to a backup location, and then—assuming no errors occur—the backup location is renamed to the name specified by
a; otherwise, the data is written directly to
atomicallyis ignored if
ais not of a type the supports atomic writes.
true if the operation succeeds, otherwise
Since at present only
file:// URLs are supported, there is no difference between this method and
write(to, 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
File instead. For more information, seeSecuring File Operations in Secure Coding Guide.