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 ...
随机推荐
- 如何远程运行PowerShell命令?
首先, 被remote运行PowerShell的windows必须已经join了domain. 其次, 该Windows的PowerShell必须开启对remote command的接受, 运行下面的 ...
- jquery ajax跨域
JSONP是一个非官方的协议,它允许在服务器端集成Script tags返回至客户端,通过javascript callback的形式实现跨域访问 方法一: jsonp之 getJSON js var ...
- Android -- Dialog动画
window_in.xml <?xml version="1.0" encoding="utf-8"?> <set xmlns:android ...
- 条件随机场(CRF)原理和实现
版权声明:作者:金良山庄,欲联系请评论博客或私信,个人主页:http://www.jinliangxu.com/,CSDN博客: http://blog.csdn.net/u012176591 目 ...
- .NET 常用加密、解密& 数字签名算法
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Run ...
- 微信小程序 this.data与this.setData
一.摘要 小程序中我们会经常使用到this.data与this.setData.其中this.data是用来获取页面data对象的,而this.setData是用来更新界面的.那么他们之间的区别与联系 ...
- Mac OS X /home 目录权限修改
Mac OS X /home 目录权限修改 http://ju.outofmemory.cn/entry/283070 sudo vi /etc/auto_master # 注释掉 /home那一行 ...
- Is there anyway to discover which ip addresses are connected to the db?
From mongo shell run db.currentOp() to show all active connections or db.currentOp(true) to show all ...
- Chrome中的哪些端口是限制使用的?
The following is a list of all of the restricted ports on Chrome: 1, // tcpmux 7, // echo 9, // di ...
- Slitaz 中文定制手册
源: http://www.simplemind.info/technolife/opensource/slitaz-cn.html 有关 Slitaz 的一些网站 slitaz的网站:http:// ...