defaultManager
Returns the shared file manager object for the process.
+ (NSFileManager *)defaultManager
Return Value
The default
NSFileManager
object for the file system.Discussion of [NSFileManager defaultManager]
This method always returns the same file manager object. If you plan to use a delegate with the file manager to receive notifications about the completion of file-based operations, you should create a new instance of
NSFileManager
(using the init
method) rather than using the shared object.
Example of [NSFileManager defaultManager]
NSDictionary *fileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:URL error:&attributesError];
NSNumber *fileSizeNumber = [fileAttributes objectForKey:NSFileSize];
long long fileSize = [fileSizeNumber longLongValue];