Alamofire使用报错Extra argument 'method' in call解决办法
2017-03-10 13:59
120 查看
使用Alamofire的时候,在用这句的时候报错了:
Extra argument 'method' in call
一开始以为是参数method没写对,纠结了很久,没解决,只好查资料,发现原来是因为其他参数的问题。
我这里是因为parameters的缘故: [] 写错了,变成 [:] 这样就好了
如果你写的对的,就看下其他几个参数是否写对了
一般会有这样几个:
1、url是字符串格式
2、parameters格式没写对,如果空写nil或[:]就行
3、encoding写错了
等等
一般都是参数问题导致的。
参考资料:
http://stackoverflow.com/questions/39571812/extra-argument-method-in-call
Extra argument 'method' in call
Alamofire.request("", method: HTTPMethod.get, parameters: [], encoding: JSONEncoding.default, headers: nil).responseJSON { (response) in //是否请求成功 if let jsonValue = response.result.value { print(jsonValue) } }
一开始以为是参数method没写对,纠结了很久,没解决,只好查资料,发现原来是因为其他参数的问题。
我这里是因为parameters的缘故: [] 写错了,变成 [:] 这样就好了
如果你写的对的,就看下其他几个参数是否写对了
一般会有这样几个:
1、url是字符串格式
2、parameters格式没写对,如果空写nil或[:]就行
3、encoding写错了
等等
一般都是参数问题导致的。
参考资料:
http://stackoverflow.com/questions/39571812/extra-argument-method-in-call
相关文章推荐
- php在iis上配置时报Fatal error: Call to undefined function mysql_connect() in 错误解决办法
- phpMyAdmin出现Fatal error: Call to undefined function __() in ..../core.lib.php on line 229解决办法
- 关于Grails在输入命令出现Regression in verifier for <init> method call from inside of a branch的BUG解决办法
- Python3.x中,使用print时出错(SyntaxError: Missing parentheses in call to 'print')解决办法
- php在iis上配置时报Fatal error: Call to undefined function mysql_connect() in 错误解决办法
- Python3.x中,使用print时出错(SyntaxError: Missing parentheses in call to 'print')解决办法
- Caused by: java.lang.UnsupportedClassVersionError: Bad version number in .class file给出解决办法
- 安装FastCgi错误( In function `init_module': ) 解决办法
- MyEclipse:Null component Catalina:type=JspMonitor,name=jsp,WebModule,Bad version number in .class file的解决办法
- 安装oracle时提示Error in CreateOUIProcess(): 13 : Permission denied 的详细解决办法。
- userinits.exe, wupcltr.exe的分析及解决办法
- xxx is not in the sudoers file. This incident will be reported (解决办法)
- dotproject的Call to a member function Execute() 解决办法
- ext 中 missing } in XML expression 的解决办法
- error LNK2001: unresolved external symbol "public: virtual __thiscall CppUnit的解决办法
- 关于“error LNK2005:…… already defined in”的解决办法
- SQL Server中传入select语句in范围参数的解决办法
- 编写驱动 错误error LNK2019: unresolved external symbol _DriverEntry@8 referenced in function _GsDriverEntry@8的解决办法
- ORA-01033: ORACLE initialization or shutdown in progress 解决办法
- Fatal error: Call to undefined function mysql_connect()解决办法