2017-12-27 172 views
0

我已搜索有关此错误,我没有找到有用的。 这里是我的代码: - 呼叫Alamofire - 额外参数'方法'在调用

@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 
    } 
} 

额外的参数“方法”我收到此错误

回答

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"] 
相关问题