获取硬盘的容量

NSFileManager *fm = [NSFileManager defaultManager];

    NSDictionary *fattributes = [fm attributesOfFileSystemForPath:NSHomeDirectory() error:nil];

     

  

    NSLog(@"%lldG",[[fattributes objectForKey:NSFileSystemSize] longLongValue]/1000000000);

    NSLog(@"%lldG",[[fattributes objectForKey:NSFileSystemFreeSize] longLongValue]/1000000000);

你可能感兴趣的:(内存(ram))