If someone is still looking for an answer, then: please note that the fileAttributesAtPath method is void, so use the attributesOfItemAtPath method
Example:
//get full pathname of bundle directory NSString *bundlePath = [[NSBundle mainBundle] bundlePath]; //get paths of all of the contained subdirectories NSArray *bundleArray = [[NSFileManager defaultManager] subpathsOfDirectoryAtPath:bundlePath error:nil]; //to access each object in array NSEnumerator *filesEnumerator = [bundleArray objectEnumerator]; NSString *fileName; unsigned long long int fileSize = 0; NSError *error = nil; //return next object from enumerator while (fileName = [filesEnumerator nextObject]) { NSDictionary *fileDictionary = [[NSFileManager defaultManager] attributesOfItemAtPath:[bundlePath stringByAppendingPathComponent:fileName] error:&error]; fileSize += [fileDictionary fileSize]; } //converts a byte count value into a textual representation that is formatted with the appropriate byte modifier (KB, MB, GB and so on) NSString *folderSizeStr = [NSByteCountFormatter stringFromByteCount:fileSize countStyle:NSByteCountFormatterCountStyleMemory]; NSLog(@"App size (bundle size): %@ \n\n\n",folderSizeStr);
source share