TOSMBClient
TOSMBClient copied to clipboard
Problems when Attempting to Download
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 ConnectError
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
@TimOliver Any Ideas why this is happening?
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.