ios - 我如何在 alamofire post 请求中发送 JSON 变量作为参数

标签 ios json swift alamofire xcode8

Alamofire.request("https://test.com", method: .post, parameters: d, encoding: JSONEncoding.default)
        .responseJSON { response in
        print(response)
    }

我正在使用上述方法使用 Alamofire 发送 post 请求。这里“d”是 JSON 变量。但是出现错误,提示调用中存在额外的争论方法。为什么会这样。

最佳答案

尝试发送这样的参数:

let params: [String: Any] = [Key 1: value1, Key 2: value2]

关于ios - 我如何在 alamofire post 请求中发送 JSON 变量作为参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51498057/

相关文章:

javascript - 从字符串层次结构创建 JSON 树

c# 反序列化 JSON web api 响应

swift - 我可以从收到推送通知的设备上删除推送通知吗?

ios - 获取已删除实体的关系。 (碰撞)

iphone - 无法在 NSUserDefaults 中保存 NSMutableArray

ios - 为什么 ADEumScreenshotOperationsController 会发生崩溃?

javascript - 使用 Ext 解析简单的 JSON 给出 SyntaxError : Unexpected token ILLEGAL

ios - Realm addNotificationBlock 返回错误

IOS 8 NSLocationAlwaysUsageDescription 自定义翻译

iphone - NSFetchedResultsController : Fill TableView with fetched entity and its related entity