1774 Views 5 Replies Latest reply: Jul 30, 2008 3:33 PM by hotpaw2
If you are trying to get files off of your iPhone for debugging you can go to the Organizer in XCode. Under the installed applications you can expand your application. Below that you will see "Application Data". Click on the down arrow next to "Application Data". This will transfer the application data to your computer. You can browse it in the organizer under "Projects & Sources".
If you want users to be able to get files off of their iPhones to their PC I believe that they only way to do this is through your web server. Have your iPhone app upload the files to your web server and then let users download them.
Have you been able to actually get this to work? I've been looking at it for some time with no such luck. I am writing a small file to the Documents directory, supposedly, yet nothing shows up in he Organizer's data dump.
I have tried both C's stdio routines and NSFileHandle routines.
I am getting a valid handle back from the open() call, write() shows the expected number of bytes written, but nothing shows.
And example filepath is : /var/mobile/Applications/5D5C66F0-C25F-402E-90A7-1167062E57D7/Documents/stringD ump.txt
The data is written out in the Simulator's directories, but never on the device.
I did try immediately reopening the file after closing it and get a -1 handle, so it seems as if the data is never actually being written out even though the functions claim it is.
I was only able to get the file through the organizer with the latest 2.0 SDK (I haven't tried the 2.1 yet). To test the file creation you can use the simulator and check ~/Library/Application Support/iPhone Simulator/User/Application. In there you will find the folder for your application and the Documents folder within that.
To get the path I am doing
NSFileManager* fileManager = [NSFileManager defaultManager];
NSArray* docDirectories = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
if ([docDirectories count] > 0)
NSString* docDir = [docDirectories objectAtIndex:0];
const char* cDocDir = [docDir UTF8String];
Then I use standard fopen, fread, fwrite, etc for the file access.