Skip to content

I cannot create a file with writeContents #189

Open
@uguraltinsoy

Description

@uguraltinsoy
func creatingFile(_ name:String, _ mime_type:String = "txt", completion: @escaping () -> Void) {
        guard let documentsProvider = WebDAVFileProvider(baseURL: URL(string: server.host)!, credential: credential) else { return }
        let filePath = "\(path)/\(name).\(mime_type)"
        documentsProvider.writeContents(path: filePath, contents: nil, atomically: true, overwrite: false, completionHandler: { error in
            guard error == nil else { return }
            completion()
        })
    }

I get the following error in the console and completionHandler does not work at all, I do not get an error message

The request of a upload task should not contain a body or a body stream, use `upload(for:fromFile:)`, `upload(for:from:)`, or supply the body stream through the `urlSession(_:needNewBodyStreamForTask:)` delegate method.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions