Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems when Attempting to Download #66

Open
anonymouz4 opened this issue Jul 5, 2018 · 2 comments
Open

Problems when Attempting to Download #66

anonymouz4 opened this issue Jul 5, 2018 · 2 comments

Comments

@anonymouz4
Copy link

anonymouz4 commented Jul 5, 2018

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
Copy link
Author

@TimOliver Any Ideas why this is happening?

@TimOliver
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants