Writes the contents of the array to a file at a given path.
- iOS 2.0–11.0Deprecated
- macOS 10.0–10.13Deprecated
- Mac Catalyst 13.0–13.0Deprecated
- tvOS 9.0–11.0Deprecated
- watchOS 2.0–4.0Deprecated
The path at which to write the contents of the array.
pathcontains a tilde (~) character, you must expand it with
expandingbefore invoking this method.
Tilde In Path
true, the array is written to an auxiliary file, and then the auxiliary file is renamed to
false, the array is written directly to
trueoption guarantees that
path, if it exists at all, won’t be corrupted even if the system should crash during writing.
true if the file is written successfully, otherwise
If the array’s contents are all property list objects (
NSDictionary objects), the file written by this method can be used to initialize a new array with the class method
array or the instance method
init(contents. This method recursively validates that all the contained objects are property list objects before writing out the file, and returns
false if all the objects are not property list objects, since the resultant file would not be a valid property list.