Alamofire - 电话中的额外参数'方法'

问题描述 投票:0回答:2

我搜索了这个错误,我发现没有用。这是我的代码: -

   @IBAction func btnSave(_ sender:UIButton) {

    let teamName=txt1.text
    let memberCount = txt2.text

    let postParameters = "name="+teamName!+"&member="+memberCount!;
    Alamofire.request(URL_SAVE_TEAM,method:.post, parameters: postParameters, encoding: JSONEncoding.default).responseJSON { response in
            print(response.request as Any)  // original URL request
            print(response.response as Any) // URL response
            print(response.result.value as Any)   // result of response serialization
    }
}

调用中的额外参数'方法'我收到此错误

ios swift alamofire
2个回答
1
投票

我已经通过了这个论点,它会正常工作。试试这个:

     let manager = Alamofire.SessionManager.default

     manager.request(url, method: .post, parameters: param,headers: nil)
        .responseJSON { response in

            switch response.result {
            case .success(_):
                if let value = response.result.value
                { }
            }
      }

0
投票

改变你的postParameters变量如下:

let postParamaters = ["name" : "teamName", "member" : "memberCount"]
© www.soinside.com 2019 - 2024. All rights reserved.