Using FTP with NSURL

I want to write a cocoa application that downloads a file using ftp. I read about the NSURL class that has "NSVLHandle FTP Property Keys". I want to know how to use these constants to provide username and password on an ftp site.

0


source to share


2 answers


NSURLHandle is deprecated and has been around for a while. Use NSURLConnection or NSURLDownload instead. Or create one of these objects with a URL like this:

ftp: // user: password@ftp.example.com /foo/bar.zip

Or, implement a delegate authentication method and pass a standard url:



ftp://ftp.example.com/foo/bar.zip

If you need to do anything more complex than downloading a file, I suggest you take a look at ConnectionKit , which provides full FTP connection support.

+5


source


Have you tried to insert username and password into the URL? How:

ftp://user:pass@ftp.somewhere.com/path/to/file

      



If not, you will probably find what you need in the documentation .

+1


source







All Articles