FileProvider icon indicating copy to clipboard operation
FileProvider copied to clipboard

FTPFileProvider.isReachable returns error, even though everything's working properly

Open Nathipha opened this issue 5 years ago • 3 comments

I'm using the latest version of the library (with Swift 5, Xcode 10) and have just run into the same problem as the author of this closed one:

ftpProvider?.isReachable(completionHandler: { (success, error) in
    print("Success: \(success), Error: \(error)")
    if success {
        //Continue
    } else {
        //Show error message
    }
})

pretty much instantly always "fails" with the error:

Success: false, Error: Optional(Error Domain=NSURLErrorDomain Code=-1011 "(null)" UserInfo={NSErrorFailingURLKey=ftp://10.1.1.15:16/, NSURL=ftp://10.1.1.15:16/, NSErrorFailingURLStringKey=ftp://10.1.1.15:16/})

error!.localizedDescription gives some more information and is output twice (!):

Success: false, Error: The operation couldn’t be completed. (NSURLErrorDomain error -1011.)

If I ignore "success", I can:

  • log into the ftp server
  • list files with ".contentsOfDirectory()"
  • read files with ".contents()"
  • download files with ".copyItem()"

just fine and there are no more error messages (still dealing with everything being done twice but that's are different problem).

If I give it an invalid URL, the output after about a minute is pretty similar (the error code is the only difference):

Success: false, Error: The operation couldn’t be completed. (NSURLErrorDomain error -1001.)

Why is it throwing an error message, even though login seems to work and complete just fine?

Nathipha avatar Jun 18 '19 11:06 Nathipha

I have the same problem, is there a solution? thank you.

Stermop avatar Sep 06 '19 03:09 Stermop

@Stermop I didn't find a solution when I was using the library. I ended up checking what error code means what and then just ignored the error that was thrown when it was successful.

I'm not using the library anymore though because it doesn't look like @amosavian is supporting it any more and there are a lot more problems than just this one: Even though they are small, the last one I found made the library unusable for me (simply didn't work with my server), so now I'm using BlueSocket and built my own reading/writing library around it.

Nathipha avatar Sep 09 '19 08:09 Nathipha

@Nathipha Thank you, I've found the solution for this problem, insert return in line 324 of FTPFileProvider.swift will be ok.

But FTPFileProvider.isReachable still returns error, I will try other ways to solve my problems. Thank you again.

Stermop avatar Sep 09 '19 09:09 Stermop