Instance Method

initWithContentsOfFile:

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

Declaration

- (NSMutableArray<ObjectType> *)initWithContentsOfFile:(NSString *)path;

Parameters

aPath

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

Return Value

A mutable array initialized to contain the contents of the file specified by aPath or nil if the file can’t be opened or the contents of the file can’t be parsed into a mutable array. The returned object must be different than the original receiver.

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). 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.

+ arrayWithContentsOfFile:

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

+ 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.

- initWithContentsOfURL:

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