Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/119.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 表达式类型不明确,在swift requestjson中没有更多上下文_Ios_Swift - Fatal编程技术网

Ios 表达式类型不明确,在swift requestjson中没有更多上下文

Ios 表达式类型不明确,在swift requestjson中没有更多上下文,ios,swift,Ios,Swift,这行有错误 Alamofire.Request(urlLis, method: .post, parameters: parameter, encoding: URLEncoding.default, headers: nil) .validate(statusCode: 200..<300) .responseJSON \\errror here { response in Alamofire.Request(urlLis,方法:.post,参数:参数,编码:U

这行有错误

Alamofire.Request(urlLis, method: .post, parameters: parameter, encoding: URLEncoding.default, headers: nil)
    .validate(statusCode: 200..<300)
        .responseJSON \\errror here { response in
Alamofire.Request(urlLis,方法:.post,参数:参数,编码:URLEncoding.default,头:nil)
.验证(状态代码:200。。
@IBOutlet weak var usename: UITextField!

@IBOutlet weak var password: UITextField!

@IBOutlet weak var login button: UIButton!

@IBOutlet weak var termsCondition: UILabel!

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view.
    
    setUpElements()
}

func setUpElements(){
    Utilities.styleTextField(usename)

    Utilities.styleTextField(password)

    Utilities.styleFilledButton(loginButton)


}

class  func toastView(messsage : String, view: UIView ){
       let toastLabel = UILabel(frame: CGRect(x: view.frame.size.width/2 - 150, y: view.frame.size.height-100, width: 300,  height : 35))
       toastLabel.textColor = UIColor.white
       toastLabel.textAlignment = NSTextAlignment.center;
       view.addSubview(toastLabel)
       toastLabel.text = messsage
       toastLabel.alpha = 1.0
       toastLabel.layer.cornerRadius = 10;
       toastLabel.clipsToBounds  =  true
    UIView.animate(withDuration: 4.0, delay: 0.1, options: UIView.AnimationOptions.curveEaseOut, animations: {
           toastLabel.alpha = 0.0
           
       })
   }


@IBAction func loginTapped(_ sender: Any) {
    
    guard let email = usename.text, !(usename.text?.isEmpty)!
    else {
        return
}
    
    guard let pwd = password.text, !(password.text?.isEmpty)!
    else {
        return
}
    
    let urlLis = "Some API VALUE"
    
    let parameter: Parameters = [
        "email": email,
        "password": PWD
    
    ]
    
    Alamofire.Request(urlLis, method: .post, parameters: parameter, encoding: URLEncoding.default, headers: nil)
    .validate(statusCode: 200..<300)
        .responseJSON { response in
           
            switch response.result {
            case .success(let data):
                print("isi: \(data)")
                ViewController.toastView(messsage: "Login Successful", view: self.view)
                
                
            case .failure(let error):
                alert.addAction(UIAlertAction(title: "Close", style: .default, handler: { (_: UIAlertAction) in
                    print("OK")
                }))
                
                self.present(alert, animated: true, completion: nil)
                print("need text")
                print("Request failed with error: \(error)")