Type Method

arrayWithContentsOfFile:

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

Declaration

+ (NSMutableArray<ObjectType> *)arrayWithContentsOfFile:(NSString *)path;

Parameters

aPath

The path to a file containing a string representation of a mutable array produced by the writeToFile:atomically: method.

Return Value

A mutable array containing the contents of the file specified aPath. Returns nil if the file can’t be opened or if the contents of the file can’t be parsed into a mutable array.

Discussion

The mutable array representation in the file identified by aPath must contain only property list objects (NSString, NSData, NSDate, NSNumber, NSArray, or NSDictionary objects). For more details, see Property List Programming Guide. The objects contained by this array are immutable even if the array is mutable.

See Also

Creating and Initializing a Mutable Array

+ arrayWithCapacity:

Creates and returns an NSMutableArray object with enough allocated memory to initially hold a given number of objects.

+ arrayWithContentsOfURL:

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

- init

Initializes a newly allocated array.

- initWithCapacity:

Returns an array, initialized with enough memory to initially hold a given number of objects.

- initWithContentsOfFile:

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

- initWithContentsOfURL:

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