获取磁盘空间大小
RT:
-(float)getTotalDiskSpaceInBytes {
float totalSpace = 0.0f;
NSError *error = nil;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSDictionary *dictionary = [[NSFileManager defaultManager] attributesOfFileSystemForPath:[paths lastObject] error: &error];
if (dictionary) {
NSNumber *fileSystemSizeInBytes = [dictionary objectForKey: NSFileSystemSize];
totalSpace = [fileSystemSizeInBytes floatValue];
} else {
NSLog(@"Error Obtaining File System Info: Domain = %@, Code = %@", [error domain], [error code]);
}
return totalSpace;
}