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

WebDAV Download Override File #159

Open
Dirk23 opened this issue Apr 2, 2020 · 3 comments
Open

WebDAV Download Override File #159

Dirk23 opened this issue Apr 2, 2020 · 3 comments

Comments

@Dirk23
Copy link

Dirk23 commented Apr 2, 2020

Hello,

I would like to include WebDAV as an alternative to Dropbox in my project. What my app does is upload and download a file. I copied the demo code and now I'm trying it out a bit. I noticed that the first time I downloaded the file from my WebDAV server, I had no problems saving it to the iPhone, but the next download fails, probably because the local file is not overwritten. Here the message from the simulator:

Downloading kb_daten.sqlite to kb_daten.sqlite: 34.594597 completed.
Downloading kb_daten.sqlite to kb_daten.sqlite: 69.18919 completed.
Downloading kb_daten.sqlite to kb_daten.sqlite: 100.0 completed.
copying kb_daten.sqlite to file:///Users/dirk/Library/Developer/CoreSimulator/Devices/A54B2D35-83C6-4A3E-9D29-BD2419BBBCED/data/Containers/Data/Application/1C8379E3-3EC9-426A-A0A3-BB2F6418D62E/Documents/kb_daten.sqlite has been failed.

I have seen that there is an "override: true", but not with the function used in the example. Here is the code the example uses and comments out the code that overwrites the file:

let progress = webdav?.copyItem(path: remotePath, toLocalURL: localURL, completionHandler: nil)
// let progress = webdav?.copyItem(path: remotePath, to: localURL.absoluteString, overwrite: true, completionHandler: nil)

Unfortunately the progress does not seem to work with the variant that overwrites the file.

How can I download a file, overwrite the local file and still get a progress?

@Dirk23
Copy link
Author

Dirk23 commented Apr 2, 2020

I tried to add override: true but when doing this, I get a errormessage:
Bildschirmfoto 2020-04-02 um 10 28 31

@Dirk23
Copy link
Author

Dirk23 commented Apr 20, 2020

Is there no way to download a file from Webdav to a iOS Device and override the existing File?

@magicyoda
Copy link

Same problem here. I ended by removing the actual file (if already existing), at path "localURL" with
// remove actual temp file do { try FileManager.default.removeItem(at: localURL) } catch let error as NSError { print("Error: \(error.domain)") }

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