Alamofire调用中的额外参数“方法” [英] Alamofire extra argument 'method' in call

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

问题描述

我使用 Alamofire 4.0.1并具有以下代码:

I use Alamofire 4.0.1 and have this code:

let params = Mapper().toJSON(group)

Alamofire.request("\(Config().apiAdminTableGroup)\(group.id)/", method: .put, parameters: params, headers: Config().apiHeaders, encoding: JSONEncoding.default)
    .responseJSON { response in
        ...
}

但出现此错误:


额外的参数'method'在呼叫

Extra argument 'method' in call

这是根据文档,是此错误还是?

This is by documentation, is this bug or?

推荐答案

检查参数标题的结构是否正确,如果您提到的错误出现。看起来应该像这样:

Check that the structure of your parameters and headers are right, if not the error you mentioned appears. It should look like that:

Alamofire.request("\(Config().apiAdminTableGroup)\(group.id)/", method: .put, parameters: ["param1":"1", "param2":"2"], encoding: JSONEncoding.default, headers: ["Authorization": "Basic xxx"])

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

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