swift - 带有 json 编码的 Alamofire post 请求

标签 swift alamofire

如何使用具有整数列表的 json 参数使用 Alamofire 发送发布请求,即,我的服务器需要一个字典,其键值是一个整数列表。

我希望参数为 {"abc":[1,2,3]}。如何在 swift 中将其与 Alamofire 的 post 请求一起发送?

最佳答案

您尝试过以下方法吗?

 var parameter  = ["abc": [1,2,3]]
 Alamofire.request(.POST, "http://www.yoursite.com/api" , parameters:parameter)

我还会查看 Alamofire github documentation 上的文档这真的很有帮助。

关于swift - 带有 json 编码的 Alamofire post 请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31499735/

相关文章:

swift - 在 Promisekit 完成运行并在 Swift 中返回正确的值之前循环递增并重新运行

ios - 为什么我在 AFNetworking 中得到 'Content-Length' 而在 Alamofire 中却没有?

swift - Xcode 8 - 如何将 .app 文件提供给其他人进行测试

swift - 使用 alamofireimage 在 UIImageview 中显示图像

ios - Alamofire HTTPS 请求失败

ios - 理解 swift Alamofire completionHandler

ios - 从解析中查询图像和文本

swift - '(Int) -> Int' 不可转换为 'Int'

swift - 从应用内打开 Apple 的订阅窗口

swift - Alamofire 5,如何停止所有请求,刷新访问 token 并重新运行所有停止的请求?