-1
我JSON如下它必须包括为机构POST请求,如何使用Alamofire在Swift 3中发送给定的JSON作为POST请求中的参数?
{
"type" : "myData",
"condition" : {"projectid": 40}
}
应该如何我POST请求使用Alamofire形成?
我JSON如下它必须包括为机构POST请求,如何使用Alamofire在Swift 3中发送给定的JSON作为POST请求中的参数?
{
"type" : "myData",
"condition" : {"projectid": 40}
}
应该如何我POST请求使用Alamofire形成?
您需要简单地创建参数Dictionary
。
let parameters: [String:Any] = [ "type" : "myData", "condition" : ["projectid" : 40]]
现在把这个parameters
字典,Alamofire
。
Alamofire.request(urlString, method: .post, parameters: parameters, encoding: JSONEncoding.default).responseJSON { response in
print(response)
}
工程就像一个魅力! – SeaWarrior404
@ SeaWarrior404欢迎伴侣:) –