How To Find Available Disk Space of iOS Device? AasimNaseem, February 14, 2012April 27, 2025 Hello, iOS fellows; Hope life is as bright as the retina display of iPhone 4S (: Well, its a Valentine’s night and I’m writing this blog post at mid night, thinking that may be someone get some benefit with these few lines and saved his/her time to googling here and there; Ahh what a priorities of an engineer? (: I was working on an iOS application where I had needed to determine the available disk space on user’s device, to warn the user about storage. Here is the code I used that finds out the space in bytes: [code] +(void)calculateSpaceOnDisk { NSError *error = nil; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES); NSDictionary *dictionary = [[NSFileManager defaultManager] attributesOfFileSystemForPath:[paths lastObject] error: &error]; if (dictionary) { float freeSpace = [[dictionary objectForKey: NSFileSystemFreeSize] floatValue]; float totalSpace = [[dictionary objectForKey: NSFileSystemSize] floatValue]; } else { NSLog(@"Error Obtaining File System Info: Domain = %@, Code = %@", [error domain], [error code]); } }//end calculateSpaceOnDisk: [/code] The highlighted lines are soul of this post. Note that I’m storing all of my application’s data in Library/Cache directory, not in /Document; Not sure right now how it may affect the above piece of code; Stay bright; iOS available disk spacefind free space in xcodeiPhoneNSFileSystemFreeSizeNSFileSystemSizeNSSearchPathForDirectoriesInDomains