我如何找到iphone磁盘空间? [英] how do i find out iphone Disk Space?
本文介绍了我如何找到iphone磁盘空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在创建一个iphone性能应用程序,我想知道iPhone上可用的磁盘空间......我知道很多应用程序都这样做但我似乎无法在任何地方找到这一点
I am creating an iphone performance app in which I would like to know the Disk Space available on iphone ... I know that a lot of apps do this but I cant seem to find this bit anywhere
推荐答案
+(float)getTotalDiskSpaceInBytes {
float totalSpace = 0.0f;
NSError *error = nil;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSDictionary *dictionary = [[NSFileManager defaultManager] attributesOfFileSystemForPath:[paths lastObject] error: &error];
if (dictionary) {
NSNumber *fileSystemSizeInBytes = [dictionary objectForKey: NSFileSystemSize];
totalSpace = [fileSystemSizeInBytes floatValue];
} else {
DLog(@"Error Obtaining File System Info: Domain = %@, Code = %@", [error domain], [error code]);
}
return totalSpace;
}
这篇关于我如何找到iphone磁盘空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文