//调用系统api返回一个字典
NSDictionary *systemAttributes = [[NSFileManager defaultManager] fileSystemAttributesAtPath:NSHomeDirectory()];
//获取总容量
NSString *diskTotalSize = [systemAttributes objectForKey:@"NSFileSystemSize"];
// 获取剩余空间
NSString *diskFreeSize = [systemAttributes objectForKey:@"NSFileSystemFreeSize"];
新手分享,大神勿喷!谢谢!