I am developing an iPhone application with swift. and I'am using Alamofire framework for handling http requests. I use Alamofire.request
for POST , GET and etc like this:
Alamofire.request(.POST, myURL , parameters: ["a": "1", "b" : "2" ])
.response { (request, response, data, error) in
}
And I use Alamofire.upload
to upload image to server this :
Alamofire.upload(.POST, uploadURL , fileURL)
And both works perfectly, but now I want to upload an image and also send some parameters with, and my content type should be multipart/form-data
and Alamofire.upload
does not accept parameters.
There are two more question on SO about this issue with swift, which first one is not using Alamofire (and really, why not?) and in second one, mattt (Alamofire Developer) cited to use encoding parameters.
I checked his example, but still couldn't figure out how to do that.
Can any one please help me solve this problem?
Thank you! :)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…