user3766930 user3766930 - 10 days ago 6
iOS Question

Alamofire does not want to accept my parameters in the query - it says extra argument in the call

I wrote a function in

for fetching data based on different parameters. The very beginning of the function is:

func makePostQuery(_ parameters: [String:AnyObject], url: String)

Alamofire.request(url, parameters: (parameters), method: .post)
.responseJSON { response in

switch response.result {
case .success:

but the problem is that
is highlighted and raises error:

Extra argument `parameters` in call

The parameters for example are constructed like this:

var params = [
"long": lon as AnyObject,
"lat": lat as AnyObject,
"startDate": DateCalc.convertValueToDate(defaults.float(forKey: "startDate")) as AnyObject
] as [String: AnyObject]


You have a wrong order of parameters. Try this instead:

Alamofire.request(url, method: .post, parameters: parameters)