Saturday, January 13, 2024
HomeiOS Developmentios - Log In logic, for logging in if the e-mail is...

ios – Log In logic, for logging in if the e-mail is verified doesnt work even for verified emails


In register Im verifiying electronic mail and going to my account. When i log in with similar electronic mail that’s verified, it’ll say Invalid Credentials, that is the tactic

func userLoginApiHit(){
    
    DispatchQueue.predominant.async {
        CommonFunctions.startProgressView(view: self.view)
    }

    
    let parameters = "{n    "electronic mail": "(emailTxtffld.textual content!)",n    "password":"(passwrdTxtfld.textual content!)"n}"
    let postData = parameters.information(utilizing: .utf8)

    var request = URLRequest(url: URL(string: "API")!,timeoutInterval: Double.infinity)
    request.addValue("utility/json", forHTTPHeaderField: "Content material-Sort")

    request.httpMethod = "POST"
    request.httpBody = postData

    let process = URLSession.shared.dataTask(with: request) { information, response, error in
        
        DispatchQueue.predominant.async {
            CommonFunctions.dismissProgressView(view: self.view)
        }
        
      guard let information = information else {
        print(String(describing: error))
        return
      }
        
      print(String(information: information, encoding: .utf8)!)
        
        let json = JSON(information: information)
        print("json response (json)")
                       
        if json == "Invalid Credentials" {
            DispatchQueue.predominant.async {
                CommonFunctions.showAlert(self, message: "Invalid Credentials", title: appName)
            }
        }
        else {
            DataManager.CurrentUserID = String(json["id"].intValue)
            objUser.parseUserData(responseDict: json)
            
            DispatchQueue.predominant.async {
                let vc = Storyboard.instantiateViewController(withIdentifier: "TabBarViewController") as! TabBarViewController
                self.navigationController?.pushViewController(vc,animated: true)
            }
        }
        
    }

    process.resume()
    
}



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments