user2636197 user2636197 - 6 months ago 327
Swift Question

Alamofire v4 extra argument method in call error

Once I updated to alamofire version 4 I get the error: extra argument method in call

Alamofire.request("www.blabla", method: .put, parameters: parameters, headers: headers, encoding: .JSON)

I already changed it to use "method: .put" like above but I still get the error


I had this issue upgrading to Alamofire 4 and solved it by moving the headers argument and making it the last argument in the call. Also encoding: .JSON should be encoding: JSONEncoding.default.

Call should look like this:

Alamofire.request(url: myUrl, method: .put, parameters: myParams,
     encoding: JSONEncoding.default, headers: myHeaders)