TOSMBClient icon indicating copy to clipboard operation
TOSMBClient copied to clipboard

Problems when Attempting to Download

Open anonymouz4 opened this issue 7 years ago • 2 comments

Something fails here even though I think I did everything properly. It just returns Unable to connect to share.

The session and the filepath are vailid and transferred fine to the Dl-Handler. I also know that the Handler-Function gets executed (I printed something inside there)

Download Handler:

public class BackgroundTasks: NSObject, TOSMBSessionDownloadTaskDelegate {
    
    var downloadSession: TOSMBSession?
    var downloadTask: TOSMBSessionDownloadTask?
    var filePath: String?
    
    public func downloadFile(from session: TOSMBSession?, atFilePath filePath: String) {
   
        self.downloadSession = session
        self.downloadTask = session?.downloadTaskForFile(atPath: filePath, destinationPath: nil, delegate: self)
        self.downloadTask?.resume()
        print(downloadTask?.countOfBytesExpectedToReceive) //-> Returns 0
    }
    
    public func downloadTask(_ downloadTask: TOSMBSessionDownloadTask?, didWriteBytes bytesWritten: UInt64, totalBytesReceived: UInt64, totalBytesExpectedToReceive totalBytesToReceive: Int64) {
        
        print("downloadTask - didWriteBytes - \(bytesWritten)")
        print("downloadTask - totalBytesReceived - \(totalBytesReceived)")
        print("downloadTask - totalBytesExpectedToReceive - \(totalBytesToReceive)")
    }
}

Call: –> From Different ViewController BackgroundTasks().downloadFile(from: session, atFilePath: editItems![0].filePath!)

If I do the complex call with own handlers and without extra class, than I also get a Could not Connect Error

This is really important for me bc my whole app is complete besides the downloading. If anyone has an idea I would very appreciate it

anonymouz4 avatar Jul 05 '18 20:07 anonymouz4

@TimOliver Any Ideas why this is happening?

anonymouz4 avatar Jul 31 '18 16:07 anonymouz4

None, sorry. :(

I have no idea what sort of share you're connecting to, or what point it could be failing. I'd recommend you breakpoint my code and see if you can see where it's failing.

If it's failing at the libdsm level, then there's nothing I can do to help.

TimOliver avatar Aug 01 '18 02:08 TimOliver