这里我需要将原始数据响应发送到服务器,以便从服务器获取数据并在此quote_id,sku和qty可以更改,任何人都可以帮我如何发布数据,如下所示?< / p>
{"cartItem":{"quote_id":"fe9304ce6f173aa1876e847571756bc9","sku":"24-MB01","qty":"1"}}
答案 0 :(得分:0)
整合Alamofire,然后使用以下方法:
let key = "some_key"
let sku = "some sku"
let params: [String: Any] = [
"cartItem" : [
"quote_id" : key,
"sku" : sku,
....
]
]
// All three of these calls are equivalent
Alamofire.request("https://httpbin.org/post", method: .post, parameters: parameters)