I am using Alamofire to execute a POST request. Since this POST request may take some time, and I want to track the progress and display it as a ProgressView.
Alamofire.request(.POST, ApiLink.create_post, parameters: parameters, encoding: .JSON) .progress { (bytesRead, totalBytesRead, totalBytesExpectedToRead) -> Void in println("ENTER .PROGRESSS") println("\(totalBytesRead) of \(totalBytesExpectedToRead)") self.progressView.setProgress(Float(totalBytesRead) / Float(totalBytesExpectedToRead), animated: true) } .responseJSON { (_, _, mydata, _) in println(mydata) }
However, I noticed that the .progress block is called only after the mail request has ended, and not called several times to actually track the progress. println ("ENTER.PROGRESSS") is called only once (at the end)
How can I make .progress work with Alamofire.request POST?
Also: My options include a base64 encoded image string. I use back-end Ruby on Rails for image processing. This is a process that takes a lot of time.
source share