Accessing an FTP connection for downloading files

2019-04-17 04:04发布

问题:

i am new to iphone.. i want guidelines for accessing ftp server through objective c ,where ftp url, username,password should be given in program itself , i want to access a lot of image files from the ftp and display it in my imageview.

how to store those image files in locally and retrieve whenever needed....

thanks in advance..

回答1:

Ftp? Really? With username and password? Unless your server is really well configured, FTP is a security hole waiting to happen.

But... OK... to answer your question; there is no built in FTP client API in iOS. You'll either need to roll your own (hard, but the protocol is well documented) or use a client library (maybe easy, maybe not).

I'd start here (yes, a google search, but not meant to be flippant) and review the various libraries to see which fits your needs better.

Note that Omni's frameworks show up on that page. They write good code.


However, the best solution would be to use HTTP to communicate between your app and a server. HTTP support is built in, HTTP is ubiquitous, and it is much easier to configure a web server to be secure.



回答2:

I completely agree with bbum, however there is FTP support in iOS, and even sample code:

http://developer.apple.com/library/ios/#samplecode/SimpleFTPSample/Introduction/Intro.html%23//apple_ref/doc/uid/DTS40009243

but don't use it. use HTTPS.