Thanks for the great code. It is working but I get a memory warning when downloading a large file. Is there a way to free the memory up while in the middle of downloading a file. I can see the data has been written to the disk by checking in the data usage of the app in the settings app.