iPhone用iOSの10.3とAPFSのリリース以来、とデバイスメモリのサイズを取得:NSFileSystemSizeリターン工場のメモリサイズ - Objective-Cの
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSDictionary *dictionary = [[NSFileManager defaultManager] attributesOfFileSystemForPath:[paths lastObject] error: &error];
NSNumber *fileSystemSizeInBytes = [dictionary objectForKey: NSFileSystemSize];
NSUInteger totalDeviceSpace = [fileSystemSizeInBytes unsignedLongLongValue];
NSUInteger totalDeviceFreeSpace = [freeFileSystemSizeInBytes unsignedLongLongValue];
リターン工場メモリサイズ。たとえば、iOS 10.2では、16 Goデバイスで11,60 Goを取得しました。 10.3以上で15,99ゴー(stringFromByteCount
でフォーマットされた結果)が得られます。
古い動作を復元するにはどうすればよいですか?
ありがとうございました!あなたはこの方法で合計領域と空き領域を取得する可能性があります
、私の編集したコード – Synny
は何あなたがNSFileSystemFreeSizeを使用していない見ません。あなたはNSFileSystemSizeですが、私はあなたにその違いを示すために両方を書きました。 – Meikiem
確かに動作し、テストし、結果を教えてください。 – Meikiem