调用中的额外参数“方法" [英] Extra argument 'method' in call

查看:24
本文介绍了调用中的额外参数“方法"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在最新版本 (4.0.0) 中调用 Alamofire 请求方法时出错.

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

语法是:

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

requestParam 的类型是 [String:Any]

the type of requestParam is [String:Any]

推荐答案

我遇到了这个问题,我必须使用 JSONEncoding.default 而不是 .JSON,所以新的语法是

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: [:])

这篇关于调用中的额外参数“方法"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆