AFNetworking 2.5 uploadTaskWithStreamedRequest swift -
i have simple question swift. i'm trying figure out why can't uploading data file using put
. in example, self
subclasses afhttpsessionmanager
.
let request = self.requestserializer.multipartformrequestwithmethod("put", urlstring: url, parameters: params as! [nsobject : anyobject], constructingbodywithblock: {(formdata: afmultipartformdata!) in if attachmenttype == "image/jpeg" { formdata.appendpartwithfiledata(data, name: "image", filename: attachmentname, mimetype: "image/jpeg") } }, error: nil) let task:nsurlsessionuploadtask = self.uploadtaskwithstreamedrequest(request, progress: nil, completionhandler: { (response, responseobject, error) in }) task.resume()
i can't figure out why it's not uploading, trying log error, it's not compiling, thoughts?
let task:nsurlsessionuploadtask = self.uploadtaskwithstreamedrequest(request, progress: nil, completionhandler: { (response, responseobject, error) in nslog(error) })