Sunday, April 21, 2013

get iPhone free space example objc




NSFileSystemFreeSize
The key in a file system attribute dictionary whose value indicates the amount of free space on the file system. 
The corresponding value is an NSNumber object that specifies the amount of free space on the file system in bytes. The value is determined by statfs(). (get iPhone free space )
Available in OS X v10.0 and later.
Declared in NSFileManager.h.


Example of (get iPhone free space )


NSDictionary* fileAttributes = [[NSFileManager defaultManager] attributesOfFileSystemForPath:@"/"
                                                                                   error:&error];
unsigned long long freeSpace = [[fileAttributes objectForKey:NSFileSystemFreeSize] longLongValue];
NSLog(@"free disk space: %dGB", (int)(freeSpace / 1073741824));
// get iPhone free space