5 Replies Latest reply: Jul 30, 2008 3:33 PM by hotpaw2
Digital Agua Level 1 Level 1 (0 points)
I am looking for guidance.

I am fairly unclear on how to transfer files from the iPhone to your desktop., either mac (and/or pc). Does anybody have any high level (or detailed) direction on where to begin.

Thanks,

James

iPhone, Other OS
  • rearcog Level 1 Level 1 (0 points)
    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.

    Stephen
  • Digital Agua Level 1 Level 1 (0 points)
    Thanks for the response.

    I am looking to transfer them directly to the desktop.

    I have seen applications that can read the iTunes library over the wireless network, and was thinking there could easily be a way to just send a file the same way.
  • Proxima Level 1 Level 1 (10 points)
    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.

    Any ideas?
  • rearcog Level 1 Level 1 (0 points)
    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.

    Stephen
  • hotpaw2 Level 1 Level 1 (75 points)
    You could email the files from the iPhone to an email server running locally on the desktop computer. Or try using http, ftp or raw sockets for the transport direct to the PC.