Instance Method

initWithContentsOfURL:

Initializes a newly allocated array with the contents of the location specified by a given URL.

Declaration

- (NSArray<ObjectType> *)initWithContentsOfURL:(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 initialized to contain 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. The returned object might be different than the original receiver.

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

Initializing an Array

init

Initializes a newly allocated array.

initWithArray:

Initializes a newly allocated array by placing in it the objects contained in a given array.

initWithArray:copyItems:

Initializes a newly allocated array using anArray as the source of data objects for the array.

initWithContentsOfFile:

Initializes a newly allocated array with the contents of the file specified by a given path.

Deprecated
initWithObjects:

Initializes a newly allocated array by placing in it the objects in the argument list.

initWithObjects:count:

Initializes a newly allocated array to include a given number of objects from a given C array.