Error Handling with Full Storage

I’m attempting to download .zip files in my app which can be fairly large (hundreds of MB). Testing on a device with full storage, I’m getting a crash on download.

*** Terminating app due to uncaught exception ‘NSFileHandleOperationException’, reason: ‘*** -[NSConcreteFileHandle writeData:]: No space left on device’

Rather than crashing, is it possible to detect this error and cancel the download? Or perhaps is there a way to check the storage left before the download?

Thanks a bunch,

David

There is a community plugin that will let you get the remaining free space:  https://marketplace.coronalabs.com/corona-plugins/more-info

Or you can use Corona native builds and code the space check using native APIs.

Rob

Thanks Rob! I’ll check it out.

There is a community plugin that will let you get the remaining free space:  https://marketplace.coronalabs.com/corona-plugins/more-info

Or you can use Corona native builds and code the space check using native APIs.

Rob

Thanks Rob! I’ll check it out.