我正在尝试使用Alamofire
从@IBAction func botaoSalvar(_ sender: Any) {
let nomeUsuario = self.campoUsuario.text;
let cpf = self.campoCPF.text;
let senha = self.campoSenha.text;
let param = ["nome": nomeUsuario, "cpf": cpf, "senha": senha, "method": "app-set-usuario"]
var _: HTTPHeaders = ["Content-Type": "application/json"]
let url = "http://easypasse.com.br/gestao/wsCadastrar.php"
Alamofire.request(url, method:.post, parameters:param,encoding: JSONEncoding.default).responseJSON { response in
switch response.result {
case .success:
//print(response)
let json = JSON(response.result.value as Any)
let idusuario = json["usuario"].arrayValue.map({$0["idUsuario"].stringValue})
let nome = json["usuario"].arrayValue.map({$0["nome"].stringValue})
let cpf = json["usuario"].arrayValue.map({$0["cpf"].stringValue})
print(idusuario)
print(nome)
print(cpf)
case .failure(let error):
print(0,"Error")
}
}
获取数据,但数据来自[“ Chris Martin”],而不是Chris Martin。检查这张图片
这是我的代码
var client = CreateOAuthApiClient(context);
var token = client.GetUserTokenAsync("<userid>", "<connectionname>", "<magicCode>");
我应该如何解决? 谢谢。