Alamofire使用报错Extra argument 'method' in call解决办法
使用Alamofire的时候,在用这句的时候报错了:
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
Alamofire使用报错Extra argument 'method' in call解决办法的更多相关文章
- [Cordova+Sencha Touch] 移动开发1 sencha 2.4.0 + 在 安卓2.3.6上使用报错 - has no method 'bind'
Sencha Touch 2.3.2和2.4.0在安卓2.3上面用会报错,具体报错信息如下: 解决办法是: 打开文件:你的file:///android_asset/www/sencha-touch- ...
- adb驱动安装和使用报错笔记
adb驱动安装 adb驱动下载地址:https://adb.clockworkmod.com/ 安装时候选择一个容易记住的路径,这个很重要,因为adb驱动没有自动配置环境变量,所以实验时候将adb安装 ...
- animate is not a function(zepto 使用报错)[转]
animate is not a function(zepto 使用报错) 1.为什么使用zepto写animate报错? 因为zepto默认构建包含: Core, Ajax, Event, Form ...
- Windows下Git使用报错:warning:LF will be replaced by CRLF in ××××.××
Windows下Git使用报错: warning:LF will be replaced by CRLF in ××××.××(文件名) The file will have its original ...
- yum源使用报错
CentOS系统yum源使用报错:Error: Cannot retrieve repository metadata (repomd.xml) for repository: rpmforge. 服 ...
- 2019-9-9:渗透测试,docker下载dvwa,使用报错型sql注入dvwa
docker下载dvwa镜像,报错型注入dvwa,low级 一,安装并配置docker 1,更新源,apt-get update && apt-get upgrade &&am ...
- .net core中Grpc使用报错:The remote certificate is invalid according to the validation procedure.
因为Grpc采用HTTP/2作为通信协议,默认采用LTS/SSL加密方式传输,比如使用.net core启动一个服务端(被调用方)时: public static IHostBuilder Creat ...
- VirtualBox使用报错
VirtualBox使用报错 1.启动报错:Failed to instantiate CLSID_VirtualBox... 报错内容: Failed to instantiate CLSID_Vi ...
- mysql 数据库导入数据报错MySQL server has gone away解决办法
mysql 数据库导入数据报错MySQL server has gone away解决办法: 进入数据库执行以下命令即可: set global wait_timeout = 2880000; set ...
随机推荐
- [leetcode]Text Justification @ Python
原题地址:https://oj.leetcode.com/problems/text-justification/ 题意: Given an array of words and a length L ...
- Unique Paths II leetcode java
题目: Follow up for "Unique Paths": Now consider if some obstacles are added to the grids. H ...
- [Math]理解卡尔曼滤波器 (Understanding Kalman Filter)
1. 卡尔曼滤波器介绍 卡尔曼滤波器的介绍, 见 Wiki 这篇文章主要是翻译了 Understanding the Basis of the Kalman Filter Via a Simple a ...
- TF-IDF及其算法
TF-IDF及其算法 概念 TF-IDF(term frequency–inverse document frequency)是一种用于资讯检索与资讯探勘的常用加权技术.TF-IDF是一种统计方法,用 ...
- Linq-插入insert
1.简单形式 说明:new一个对象,使用InsertOnSubmit方法将其加入到对应的集合中,使用SubmitChanges()提交到数据库. NorthwindDataContext db = n ...
- Spark Strcutured Streaming中使用Dataset的groupBy agg 与 join 示例(java api)
Dataset的groupBy agg示例 Dataset<Row> resultDs = dsParsed .groupBy("enodeb_id", "e ...
- 【Python】torrentParser1.01
在昨天的版本上做了一些改进,如增加getAll,修改getSingleFileName等 代码: #-------------------------------------------------- ...
- ThinkPHP3.0启动过程
以Blog举例载入项目入口文件 D:\wamp\www\Examples\Blog\index.php 定义常量 APP_NAME,Blog APP_P ...
- 程序员的福音,AI可以自动修复bug了!
人工智能完全学会自己编程,可能说起来还有一种科幻感,但 AI 帮程序员找 bug 这件事,已经达到了不错的水平. 北京大学.微软亚洲研究院和中国电子科技大学就一起尝试着让 AI 找 bug.微软亚洲研 ...
- SuperMap iDesktop之导入数据
SuperMap作为一个平台软件有自己的数据格式,现要将ESRI的SHP数据导入到SuperMap的udb数据库中,可以完成导入,但也不得不说几点问题. 下面是ArcGIS中批量导入SHP的操作界面. ...