Is it possible to detect remaining disk space in device?

Discussion in 'iOS Programming' started by fenrus110, Jan 16, 2009.

  1. macrumors regular

    Joined:
    Mar 24, 2008
    #1
    Not sure if this is possible, but can you detect the amount of disk space left on the device? For an app that has a sqlite database and/or stores images or something, it could be a concern.
     
  2. macrumors 6502

    Joined:
    Sep 17, 2003
    #2
    Code:
    	NSDictionary *fsAttr = [[NSFileManager defaultManager] fileSystemAttributesAtPath:NSHomeDirectory()];
    	
    	unsigned long long freeSpace = [[fsAttr objectForKey:NSFileSystemFreeSize] unsignedLongLongValue];
    will return the free space available to you, in bytes
     

Share This Page