获取iOS空间大小

 @import Darwin.sys.mount;
- (void)method
{
    struct statfs buf;
    long long freespace = 0;
    if(statfs("/", &buf) >= 0){
        freespace = (long long)buf.f_bsize * buf.f_blocks;
    }
    if(statfs("/private/var", &buf) >= 0){
        freespace += (long long)buf.f_bsize * buf.f_blocks;
    }
    printf("空间:%lld\n",freespace);
}

你可能感兴趣的:(获取iOS空间大小)