0
@IBAction func login(sender: UIButton) {
let parameters = [
"username": usernameTextField?.text,
"password": passwordTextField?.text
]
Alamofire.request(.POST, "http://192.168.1.107:8080/api/v1/user/login", parameters: parameters, encoding: .JSON)
.validate()
.responseJSON { response in
switch response.result {
case .Success(let JSON):
print("Validation Successful")
if (JSON["status"] as! String != "Success") {
self.popup("Invalid Account", message: "Please check your username and password and try again")
}
case .Failure(let error):
print(error)
}
}
}
ユーザ名とパスワードを辞書内にハードコードしておくと、パラメータが正常に機能しました。しかし、私はそれをテキストフィールドに変更したとき、私はエラーが表示されるCannot convert value of type [String: String?] to [String: Anyobject]?
テキストフィールドのAlamofireパラメータ
どのように私はそれが受け入れられるようにパラメータanyobjectを作ることができますか?