iPhone : Transfer of files from Mac/Pc to app

2019-01-23 09:56发布

问题:

I need to transfer binary files from my pc/mac to my app. I want to allow my users to upload sound files. Am i going to have to run a web server that the user can connect to over wifi?

What are the steps i have to go through to get this up and running?

回答1:

In my apps, I use the open-source cocoahttdserver. It is quite trivial to setup in your app and connect to from a computer using the same network. They have an iPhone sample project that you can pretty much cut and paste from for basic functionality.



回答2:

Do you need to transfer the files program-atically or through a GUI? If you can use a GUI, enable file sharing, and use iTunes>IPod>Apps>File sharing to drag and drop / load files to and from your application's Documents folder.

If you need to do it programatically, here is a technical note describing different strategies to do so: http://developer.apple.com/library/ios/#technotes/tn2152/_index.html