Is it possible to determine how much free storage is left on the iphone using the iphone sdk? I'd like to adapt the cache size depending on how much space is actually left.
+3
A:
Yes, you can. Here is an example: Mac/iPhone: Show Available Usable Disk Space. They provide a class you can plug in as well, but a lot of it is simply formatting the result.
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
struct statfs tStats;
statfs([[paths lastObject] cString], &tStats);
availableDisk = (float)(tStats.f_bavail * tStats.f_bsize);
pix0r
2009-05-29 17:56:26