2

我使用了下面的方法,所以我得到了可用的存储空间.. 大约 198MB。

但是,当我检查手机时,我看到了不同的值,设置 > 常规 > 关于 > 可用 0 字节。

为什么会有不同?

{ ...

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 floatValue];
    totalFreeSpace = [freeFileSystemSizeInBytes floatValue];
    NSLog(@"Memory Capacity of %f MiB with %f MiB Free memory available.", ((totalSpace/1024.0f)/1024.0f), ((totalFreeSpace/1024.0f)/1024.0f));
    }

...

}

嗯..我用谷歌搜索了.. 2天..但我不知道确切..这就是为什么..(Iphone 200MB / iPod 160MB ..有不同的存储空间)

4

0 回答 0