amosavian / FileProvider

FileManager replacement for Local, iCloud and Remote (WebDAV/FTP/Dropbox/OneDrive) files -- Swift
MIT License
56 stars 14 forks source link

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

Open Nathipha opened 5 years ago

Nathipha commented 5 years ago

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:

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?

Stermop commented 5 years ago

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

Nathipha commented 5 years ago

@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.

Stermop commented 5 years ago

@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.