当我升级到最新的一切(Alamo 4,Swift 3和XC 8)时,以下停止发布参数,我不知道为什么……
let params = ["stripeToken": token.tokenId,"name": name,"email": email ] Alamofire.request(requestString,method: .post,parameters: params,encoding: JSONEncoding.default) .responseJSON { (response) in if response.result.value is NSNull { return }
我遇到了类似的问题,我将编码从JSONEncoding.default改为URLEncoding.httpbody或编码:URLEncoding.default
原文链接:https://www.f2er.com/swift/319047.htmlAlamofire.request(URL,encoding: URLEncoding.httpBody).responseJSON { response in if let data = response.data { let json = String(data: data,encoding: String.Encoding.utf8) print("Response: \(json)") } }