Type Method

arrayWithContentsOfURL:

Creates and returns an array containing the contents specified by a given URL.

Declaration

+ (NSArray<ObjectType> *)arrayWithContentsOfURL:(NSURL *)url;

Parameters

aURL

The location of a file containing a string representation of an array produced by the writeToURL:atomically: method.

Return Value

An array containing the contents specified by aURL. Returns nil if the location can’t be opened or if the contents of the location can’t be parsed into an array.

Discussion

The array representation at the location identified by aURL must contain only property list objects (NSString, NSData, NSArray, or NSDictionary objects). The objects contained by this array are immutable, even if the array is mutable.

See Also

Creating an Array

+ array

Creates and returns an empty array.

+ arrayWithArray:

Creates and returns an array containing the objects in another given array.

+ arrayWithContentsOfFile:

Creates and returns an array containing the contents of the file specified by a given path.

Deprecated
+ arrayWithObject:

Creates and returns an array containing a given object.

+ arrayWithObjects:

Creates and returns an array containing the objects in the argument list.

+ arrayWithObjects:count:

Creates and returns an array that includes a given number of objects from a given C array.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software