gpt4 book ai didi

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

转载 作者:搜寻专家 更新时间:2023-10-31 23:02:49 24 4
gpt4 key购买 nike

如何使用具有整数列表的 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com