0

Can anyone tell me, how to get disk storage used amount in Objective-C (ex. music - 1Gb, images - 100Mb, ..., free space - 5Gb)?

UPD: I wrote this:

NSError *error = nil;
NSDictionary* fileAttributes = [[NSFileManager defaultManager] attributesOfFileSystemForPath:@"/"error:&error];
unsigned long long freeSpace = [[fileAttributes objectForKey:NSFileSystemFreeSize] longLongValue];
unsigned long long totalSpace = [[fileAttributes objectForKey:NSFileSystemSize] longLongValue];
msg = [NSString stringWithFormat:@"free disk space: %dGB\n total disk space: %dGB", (int)(freeSpace / (1024*1024*1024)),(int)(totalSpace / (1024*1024*1024))];

But i actually need all info, about music, video, etc... like system info about disk (screenshot: http://cl.ly/image/1Y3Q3N1U3Q3A)

4

2 回答 2

4

iPhone中没有像android这样的SDCard。您的应用程序正在运行自己的沙箱。所以沙箱外没有访问权限。所以觉得是不可能的。

于 2013-03-20T07:13:04.727 回答