FTP client OSS(Library) for iOS

Now I'm working on developing iOS application which need the function of FTP client.


And I'm looking for an available OSS(Library) of FTP client but couldn't find good one.


Now I'm implementing the application with Swift4(XCode9.2, iOS11SDK)


My requirements for the OSS are below:


  • Support passive mode, FTPS, port select, make/remove folder, SSL Implicit mode(optional)
  • Avoid deprecated API as far as possible
  • Currently maintained
  • MIT or BSD License


If you know other recommended FTP client OSS for iOS, please let me know.


I'd appreciate if you would provide me helpful information.



So far I've found the following OSS.


[GoldRaccoon]

<https://github.com/albertodebortoli/GoldRaccoon>

  • I've tested FTP file upload with sample Application and it succeeded.
  • No update for nearly 4 years.
  • Has Deprecated API such as `CFWriteStreamCreateWithFTPURL`


[rebekka]

<https://github.com/Constantine-Fry/rebekka>

  • Written in Swift2
  • Has Deprecated API such as `CFWriteStreamCreateWithFTPURL`
  • I'm working on building for this OSS with Xcode9.2(Swift4). But it doesn't yet.


[FileProvider]

<https://github.com/amosavian/FileProvider>

  • Written in Swift4 and maintained even now. But no sample application.
  • I'm trying to create test application for this OSS. But it doesn't work yet.

Replies

cURL?

Why are you implementing FTP? FTP is a horrible protocol in general, and it has specific security problems that make it unsuitable for use on the modern Internet. In the vast majority of cases there are better alternatives.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
  • If you really work at 🍎 it would be super nice if you had mentioned what protocol we are supposed to use instead of leaving it up in the air :/

Add a Comment

What did you end up using?


I tested FileProvider but it's pretty buggy with Swift 5 and it doesn't look like the author's even supporting it anymore (he hasn't posted in the "Issues" section in months).

I'm also curious.. I tried FileProvider but it has some hard-coded sleep() calls in its protocol implementation that appear to be hacky and don't work with all servers, in particular, the one I'm connecting to.


Since Quinn has pointed out the deficiencies of FTP in multiple threads, I'll add that I'm connecting to an old U.S. government server that supports only FTP. I have pointed out the security problems but they have refused to upgrade for the last 4 years. The Android version of my app has no problems doing FTP. The iOS version currently uses the deprecated CFWriteStreamCreateWithFTPURL so I am worried about it suddenly breaking at some point in the future due to Apple's whims.

I'm connecting to an old U.S. government server that supports only FTP.

In this situation my advice would be to create a web service to front the FTP server. You can then talk to your web service using HTTPS, and the web service can talk to the legacy server using FTP.

This has a bunch of advantages:

  • You don’t have to worry about doing FTP on the client.

  • If the legacy server changes to break your client, it’s easy to deploy a fix.

  • It’s significantly more secure, because the insecure connection is data centre to data centre, not client to data centre.

The obvious disadvantage is that you have to maintain this infrastructure.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

I'm sorry, but I'm going to have to disagree with you on that approach.

  • FTP on the client is no big deal. I don't understand the requirement to have a native Swift solution. I did mention perhaps the most robust of all FTP clients, cURL. I'm sure there are at least a few dozen others. Yes. They are probably in C. Such is life for Swifties. Everything has to be wrapped and then implicity unwrapped again.
  • A server-based FTP gateway is three times the work. You still need the FTP client. But you also need a web server. And then you need a client to talk to the web service. If the legacy server changes, everything is broken. That's a ton of work to throw in the trash.
  • There is no inherent security in a server-side tool. Unless that web service is coded very securely, it could potentially expose all FTP credentials for all users. Users and the government would not appreciate accounts and passwords being used and potentially stored in a data centre. Individual devices would be much more secure. This is FTP. Your security is mainly tied to your obscurity. It is better to have X number of ephemeral mobile clients scattered across the world instead of one server you can beat on 24x7.


Finally, US government FTP sites don't get updated, they get replaced. A US government FTP server should have been replaced years ago. I don't know how it has lasted this long. I replaced a similar US government FTP server over a decade ago. They have very strict security requirements and are actively trying to consolidate services to reduce their internet footprint. They probably haven't "refused" to upgrade the server. They likely didn't have the funding and/or are still working on it.

Did you find a good library?


I'm having a similar issue at the moment with using FTP and Swift. We have had a proprietary device come in from a client that has it's own wireless access point built in. I've tried to implement FTP natively and I'm now having a go using the FileProvider library linked in the original post.


With both solutions I can list directories without issues however I keep getting a connection timed out 1001 error when trying to download the file:


Error Domain=NSURLErrorDomain Code=-1001 "(null)"


Haven't been able to come up with a viable solution. The aim of the solution is to pull logfiles off of the device and upload them to S3.


I've tried pulling files off the device with an app and it works without fuss, so I know this is definitely supported. The app is:


https://apps.apple.com/gb/app/ftpmanager-ftp-sftp-client/id525959186


Let me know if you find a suitable library for FTP.

I'm not actively searching for such a library. I just had the misfortune once to try to write a funky Mac app that had FTP support. As far as I'm concerned, the security issues are the least of its problems. A bigger problem is that there are so many different FTP implementations and they can behave radically differently. That is why I suggested using cURL. It is one of the oldest libraries with good support for the many different flavours of FTP. I'm sure it doesn't have a native Swift API. Even the C API is funky. But it works and itsn't difficult to use. I think it is the easiest way to go get the widest support for the many different FTP flavours.


I don't know what that app is using. It really isn't a question of what is "supported" or not. Apple doesn't "support" FTP at all anymore. But it is just a networking protocol. Depending on your networking skills, you could write a FTP client from scatch. I did that at university in Java many years ago. But the problem is that there is no way to predict what kind of funky FTP server you are going to encounter in the real world. If you want to support FTP, you are going to have to track down each one of them, get access to it somehow for testing, and try to make it work. That's just insane. That is why Apple so strongly recommends avoiding. I think the security issue is just a useful red herring because people who haven't tried to write FTP probably wouldn't believe how crazy it can be. But they are more likely to accept the security explanation, which is certainly true. In the end, Apple wants people to be happy and productive. That means avoiding FTP if at all possible.

If you really work at [Apple]

To avoid any confusion on that front DevForums, decorates posts from Apple staff. See Apple Developer > Support > Developer Forums for the details.

As to my reply, I asked that question because the best protocol for replacing FTP depends on the specific circumstances. If you follow up with a description of your circumstances, I’d be happy to offer you specific advice. However, if your not able to do that then the best I can offer is the general advice in my On FTP post.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Bumping an old thread - in my case, I need to support a Canon camera as a client that only has FTP as a viable connection option. I've added some basic FTP response code cases into the reply handler of the below project by RDerik and it looks like it'll work, just need to figure out changing the 2nd data stream for PASV or EPSV connections to xfer the photo data through.

https://rderik.com/blog/building-a-server-client-aplication-using-apple-s-network-framework/