开发者

How to Share Files Between my iPhone App and a Mac/PC

I have developed an iPhone app which stores photos in the /Documents directory of my app.

I would like to a开发者_如何学JAVAdd a feature which gives to the user the opportunity to transfer those pictures to his/her PC or Mac.

I don't really know how to do that. What is the best way, using Bonjour, bluetooth, or directly USB (if it is possible) ? I really need some advices on that point ...

Any ideas ?

PS: Forgive my English, I am French :-)


Try NSNetService to register the service in Bonjour, and NSFileHandle to send data over a socket connection associated with the service.


If you do not want to write a Mac or PC part for your app then you can also consider to build in a little http server that people can use to access the data in your app. There are some nice open source http servers available for Cocoa which you can find with Google.

Using Bonjour you can advertise your http server so that people can easily find it with a Bonjour enabled browser like Safari. (Your iPhone app's web server will appear automatically under the dynamic bonjour bookmarks items)


You've edited the question to say that it's about transferring photos. Could you store the photos on the iPhone's photo roll with UIImageWriteToSavedPhotosAlbum(), and let Apple handle getting them onto the computer?


Bonjour!

I mean that both as a greeting and an answer. You have to setup a bonjour connection over wifi to transfer files directly to and from an app. That's actually pretty simple to do on both the iPhone and Mac side. The PC is a little tougher.

You can do bluetooth but bluetooth capability is still fairly rare on desktops.


Without knowing more about your specific application, I agree with Graham Lee--either directly saving to the Camera Roll or giving the user an option to save one or more photos to the Camera Roll is much simpler than http/bonjour.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜