请问谁知道获取iphone手机内存以及硬盘存储空间大小的方法,,紧急求救啊。。。 小弟这里先谢谢了。。
问题已解决。
- (NSString *)commasForNumber:(long long) num
{
//Produce a peroperly formatted number string
//Alternatively use NSNumberFormatter
if(num < 1000) return [NSString stringWithFormate:@"%d",num];
return [[self commasForNumber:num/1000] stringByAppendingFormat:@",%03d",(num % 1000)];
}
- (void) action:(UIBarButtonItem *)bbi
{
NSFileManager *fm = [NSFileManager defaultManager];
NSDictionary *fattributes = [fm fileSystemAttributesAtPath:NSHomeDirectory()];
NSLog(@"System space: %@",[self commasForNumber:([[fattributes objectForKey:NSFileSystemSize] longLongValue])]);
NSLog(@"System free space: %@",[self commasForNumber:([[fattributes objectForKey:NSFileSystemFreeSize] longLongValue])]);
}