Instance Method

writeToURL:atomically:

Writes the contents of the array to the location specified by a given URL.

Declaration

- (BOOL)writeToURL:(NSURL *)url atomically:(BOOL)atomically;

Parameters

aURL

The location at which to write the array.

flag

If YES, the array is written to an auxiliary location, and then the auxiliary location is renamed to aURL. If NO, the array is written directly to aURL. The YES option guarantees that aURL, if it exists at all, won’t be corrupted even if the system should crash during writing.

Return Value

YES if the location is written successfully, otherwise NO.

Discussion

If the array’s contents are all property list objects (NSString, NSData, NSArray, or NSDictionary objects), the location written by this method can be used to initialize a new array with the class method arrayWithContentsOfURL: or the instance method initWithContentsOfURL:.

See Also

Storing Arrays

- writeToFile:atomically:

Writes the contents of the array to a file at a given path.

Deprecated