arrayWithContentsOfFile:
Creates and returns an array containing the contents of the file specified by a given path.
Declaration
+ (NSArray<id> *) arrayWithContentsOfFile:(NSString *) path;Parameters
- path:
The path to a file containing a string representation of an array produced by the Write(tofile:atomically:) method.
Return Value
An array containing the contents of the file specified by aPath. Returns nil if the file can’t be opened or if the contents of the file can’t be parsed into an array.
Discussion
The 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.