Noufal Kmc Noufal Kmc - 5 months ago 33
iOS Question

In iPhone, where does save a file downloaded from a iOS app

From my app, I can download a zip file from a server through NSURLConnection. While I'm downloading I'm writing to this into a file, so that it will save into documentsDirectory.

paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
documentsDirectory = [paths objectAtIndex:0];
currentDownload = [documentsDirectory stringByAppendingString:@"/Zipfile"];
NSFileHandle *fileHandle = [NSFileHandle fileHandleForWritingAtPath:currentDownload];
[fileHandle seekToEndOfFile];
[fileHandle writeData:data];
[fileHandle closeFile];

This is the code I used for downloading and its working. If I run the app in simulator, I can see the downloaded file in MAC in the folder /Users/TECSOLiMac02/Library/Application Support/iPhone Simulator/6.0/Applications/9DECB1F4-C88D-4B62-BA1F-B9D5D4E421B9/Documents/Zipfile

Where can I see this downloaded file in iPhone/iPad?


Every application is sandboxed in iPhone.Each application have it's on directory structure in device (like in simulator).

The path of document directory in mobile is something like:


The files in that directories cannot be accesses by any other applications. It can be accessed by the owner application itself. And can be accessed through code.

If you want to see the files in document directory you need to set the UIFileSharingEnabled key in the info.plist


The files in the application's document directory will be displayed on the itunes as like:

File Sharing Please check the tutorial for details.