iPad中200 MB额外的自由空间

时间:2014-03-06 12:43:06

标签: ios ipad

这里我需要知道iOS设备中可用的可用空间。为此,我在stackoverflow中经历了许多答案,最后使用this link

我正在使用的代码段,

- (uint64_t)freeDiskspaceInphone
{
uint64_t totalSpace = 0;
uint64_t totalFreeSpace = 0;

__autoreleasing 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];
    NSNumber *freeFileSystemSizeInBytes = [dictionary objectForKey:NSFileSystemFreeSize];
    totalSpace = [fileSystemSizeInBytes unsignedLongLongValue];
    totalFreeSpace = [freeFileSystemSizeInBytes unsignedLongLongValue];
    NSLog(@"Memory Capacity of %llu GB with %llu MiB Free memory available.", (((totalSpace/1024ll)/1024ll)/1024ll), ((totalFreeSpace/1024ll)/1024ll));
} else {
    NSLog(@"Error Obtaining System Memory Info: Domain = %@, Code = %d", [error domain], [error code]);
}

return totalFreeSpace/1024/1024;
}

在这个我得到的自由空间是978 MB,但当我在我的iPad中Settings --> General --> Usage时它显示为778 MB可用(自由空间)。为什么我会在错误发生的地方获得额外的200 MB?并且这个设备是越狱了,是不是这个原因?

0 个答案:

没有答案