本文介绍了具有JSON编码的Alamofire发布请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用Alamofire发送带有json的参数的发布请求,其中包含整数列表,即我的服务器需要一个字典,该字典的键值为整数列表。
How to send a post request with Alamofire with parameters as json having list of integers i.e, my server expects a dictionary whose value for the key is a list of integers.
我希望参数为{ abc:[1,2,3]}。
I want the parameters as {"abc":[1,2,3]}. How to send this along post request of Alamofire in swift?
推荐答案
您是否尝试过以下操作?
Have you tried the following?
var parameter = ["abc": [1,2,3]]
Alamofire.request(.POST, "http://www.yoursite.com/api" , parameters:parameter)
我还将在以下位置查看文档,这真的很有帮助。
I would also look at the documentation over at Alamofire github documentation which is really helpful.
这篇关于具有JSON编码的Alamofire发布请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!