Objective-c – iPhone: Writability of the Documents directory


Is there a way to write files to this directory remotely? I'm hoping it's possible to do via iTunes or whenever the iPhone is connected to a Mac/PC via USB. Could this be done with an iTunes plugin? If all else fails, is there an easy way to setup a WebDAV server on the iPhone?


Best Solution

None of the manners you suggested work, at least using the existing APIs. Each app has its own Documents directory, and has no access to other apps Documents directory, so even if you had a web server, you would only be able to write to the Documents directory of the web server, not one that can be accessed by other apps.

The best bet is to have your own app write the files you want from the remote server to its own Documents directory and then use that data as you need, from within the same app.

There may be one other solution, which I have not tried, which is to write to /tmp, but be aware that there is another tmp at the same level as your Documents folder, and I am not talking about that one.

Also, check and see whether apps that share the same bundle identifier wildcard have any way of sharing data amongst each other. See: How to share custom data between iPhone applications?