我收到此错误:
responseSerializationFailed(Alamofire.AFError.ResponseSerializationFailureReason.inputDataNilOrZeroLength)
当我想使用alamofire发布http请求时
这是我的代码:
let dict = UserDefaults.standard.object(forKey: "dict") as! [String : Any]
let token = "Bearer " + (dict["token"] as! String)
let header = ["Authorization" : token]
let parameters: Parameters = ["lat": 36.32914573119686 , "lng": 59.47487354278565 ]
Alamofire.request("http://amoozandeh.ir/api/v1/cedrus/app-index", method: .post, parameters: parameters, encoding: JSONEncoding.default, headers: header).validate().responseJSON { response in
print(response)}
令牌和api正确
非常感谢