kdbdallas
kdbdallas

Reputation: 4543

Determine Free Disk Space Allowed By Sandbox On iPhone

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

I have tried using NSFileManager's fileSystemAttributesAtPath with NSFileSystemFreeSize, but this is giving me the total free space on the iPhone and not what is available to my application by the Sandbox.

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

Upvotes: 4

Views: 1770

Answers (1)

Jason Coco
Jason Coco

Reputation: 78363

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

You can see the iPhone version of the man page here.

Upvotes: 2

Related Questions