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/