Skip to content

I cannot create a file with writeContents #189

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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