Search code examples
alamofireswift3

Extra argument 'method' in call


Getting error while calling Alamofire request method in the latest version(4.0.0).

The syntax is:

Alamofire.request(urlString,method: .post, parameters: requestParams, encoding: .JSON, headers: [:])

the type of requestParam is [String:Any]


Solution

  • I got the issue, I have to use JSONEncoding.default instead of .JSON, so the new syntax is

    Alamofire.request(urlString,method: .post, parameters: requestParams, encoding: JSONEncoding.default, headers: [:])