我正在使用alamfire来执行http请求,我也曾经使用过alamofireobjectmapper将Json转换为对象,代码成功,但是现在,我一直在等待请求完成,这是我的代码: func loadData(){ 让url =“ someUrl”
let parameterArray:[String: Any] = jsonHandle.toFarmDetailsJson(farmCode: self.farmCode!)
let encoding:URLEncoding = .default
Alamofire.request( url, method: .post, parameters: parameterArray, encoding: encoding )
.responseObject(queue: nil,
keyPath: nil,
mapToObject: nil,
context: nil,
completionHandler: { (response :DataResponse<FarmList>) ->Void in
if let result = response.result.value{
self.farmList = [result]
}
})
}