标签:容量
- (float)getTotalDiskSpace
{
float totalSpace;
NSError * error;
NSDictionary * infoDic = [[NSFileManager defaultManager] attributesOfFileSystemForPath:[self getHomeDirectory] error: &error];
if (infoDic) {
NSNumber * fileSystemSizeInBytes = [infoDic objectForKey: NSFileSystemSize];
totalSpace = [fileSystemSizeInBytes floatValue]/1024.0f/1024.0f/1024.0f;
return totalSpace;
} else {
NSLog(@"Error Obtaining System Memory Info: Domain = %@, Code = %ld", [error domain], (long)[error code]);
return 0;
}
}
- (NSString *)getHomeDirectory
{
NSString * homePath = NSHomeDirectory();
return homePath;
}
标签:容量
原文地址:http://blog.csdn.net/zh_2608/article/details/41826973