-
(NSString *)getDivceSize{
NSDictionary *fattributes = [[NSFileManager defaultManager] attributesOfFileSystemForPath:NSHomeDirectory() error:nil];
NSNumber *freeber = [fattributes objectForKey:NSFileSystemFreeSize];
NSNumber *maxber = [fattributes objectForKey:NSFileSystemSize];long long freespace = [freeber longLongValue];
long long maxspace = [maxber longLongValue];NSString * sizeStr = [NSString stringWithFormat:@"剩余空间%0.1fG / 共%0.1fG",(double)freespace/1024/1024/1024,(double)maxspace/1024/1024/1024];
return sizeStr;
}
网友评论