Home Features Docs Blog Support GitHub

NSFileSystemFreeSize returns string "NSFileSystemFreeSize" not actual long value


(Dmitry Kolesnikovich) #1

I print apple.foundation.c.Foundation.NSFileSystemFreeSize() to console with

System.out.println(apple.foundation.c.Foundation.NSFileSystemFreeSize());

But instead of getting some reasonable value I have just string “NSFileSystemFreeSize” in console output.

What Am I doing wrong?


(Marco) #2

https://developer.apple.com/documentation/foundation/nsfilesystemfreesize

Per apple documentation this is “The key in a file system attribute dictionary whose value indicates the amount of free space on the file system.”

The implementation is right, the string you get is the key, now you have to use that key to access the dictionary with the disk stats.

Here you can see an example: https://stackoverflow.com/a/5310566/1729227


(Dmitry Kolesnikovich) #3

Thanks for explanation!