1

My app downloads files. How much space I can use for downloaded files? App size is 3-4 mbytes. I save files to documents folder.

Toon Krijthe
  • 52,876
  • 38
  • 145
  • 202
Timur Mustafaev
  • 4,869
  • 9
  • 63
  • 109
  • 2
    Potential duplicate: http://stackoverflow.com/questions/2953052/what-is-the-maximum-sandbox-size-on-ipad – Luke Sep 27 '11 at 20:42
  • 1
    AFAIK there is no quota, you're just limited by free space ... – Tom Sep 27 '11 at 20:42

1 Answers1

6

There is no capacity limit except the available storage (except for the fact that the app may see a bit less storage then what is actually available on the device - some may be saved for the OS).

To get the free storage available on the device (as your app is concerned):

NSString* docsDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSDictionary *fileAttributes = [[NSFileManager defaultManager] attributesOfFileSystemForPath:docsDir error:NULL];
unsigned long long freeSpaceInBytes = [[fileAttributes objectForKey:NSFileSystemFreeSize] unsignedLongLongValue];
NSLog(@"Memory Capacity of %llu MiB.", ((freeSpaceInBytes/1024ll)/1024ll));
Danra
  • 9,546
  • 5
  • 59
  • 117