NSFileSystemFreeSize の結果を利用可能な mb/gb のユーザーフレンドリーな文字列に変換するルーチンを持っている人はいますか? 私はそれの要点を持っていると思っていましたが、奇妙な結果を得ています。
- (NSString*)getFreeSpace
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSDictionary* fileAttributes = [[NSFileManager defaultManager] attributesOfFileSystemForPath:documentsDirectory error:NULL];
unsigned long long freeSpaceInBytes = [[fileAttributes objectForKey:NSFileSystemFreeSize] unsignedLongLongValue];
NSString * space = [NSString stringWithFormat:@"Free Space: %fll", freeSpaceInBytes /1024. / 1024. /1024.];
NSLog(@"freeSpaceInBytes %llull %fll", freeSpaceInBytes, freeSpaceInBytes /1024. / 1024. /1024.);
return space;
}