Determining the free disk space allowed by the sandbox on the iPhone

I am looking for a way to determine how much free disk space is available for my application.

I tried using NSFileManager fileSystemAttributesAtPath with NSFileSystemFreeSize, but it gives me full free space on the iPhone, and not what is available to my Sandbox app.

I believe that applications are limited to using 2 Gig of space and should show how much of 2G is still available.

+4
source share
1 answer

You can use statfs (2) and check the f_bavail field. This is the amount of free space at the moment for an unprivileged application, so it should provide you with the modified space that your application is allowed to use.

You can see the iPhone man page version here .

+2
source

All Articles