Alamofire expects dictionary [String: AnyObject]? as your error says, and according to your code that you are trying to pass to the array, you need to convert it to a dictionary. Check the signature of the request function in Alamofire:
func request(method: Method, _ URLString: URLStringConvertible, parameters: [String : AnyObject]? = default, encoding: ParameterEncoding = default, headers: [String : String]? = default) -> Request
See this example in the Alamofire Document :
let params = Mapper().toJSONString(results) // json string with array of objects Alamofire.request(.PUT, "http://httpbin.org/get", parameters: ["params": params]) .response { request, response, data, error in print(request) print(response) print(data) print(error) }
Hope this helps you.
source share