3
Whenever I will do the screen pass with login and password my application to with the error below:
fatal error: unexpectedly found nil while unwrapping an Optional value
Function Signature specialization of Swift. (_fatalErrorMessage (Swift.Staticstring, Swift.Staticstring, Swift.Staticstring, Swift.Uint) -> (). (closure #2)
I checked the function returns, if there was any wrong outlet, it’s all right. This error also occurred in a simple screen transition, without any content, just drags and pulls, I do not know what can be. It prints the user and the id normally, but when passing to the other screen gives error. Follows below the part of my code in which the application to:
@IBAction func logar(sender: AnyObject) {
self.myProgress.hidden = false
self.myProgress.startAnimating()
let parametros: NSDictionary = ["email":emailField.text!, "senha":senhaField.text!]
controller.getLogin(parametros, handlerUser: {(usuario) -> () in
self.usuarioAtual = usuario
if self.usuarioAtual.msgError == "" {
self.emailField.text = ""
self.senhaField.text = ""
self.myProgress.hidden = true
self.myProgress.stopAnimating()
let storyBoard = UIStoryboard(name: "Main", bundle: nil)
let accessNavigation = storyBoard.instantiateViewControllerWithIdentifier("AccessViewController")
LoginViewController.sharedInstance.usuarioAtual = self.usuarioAtual
self.navigationController?.pushViewController(accessNavigation, animated: true)
} else {
Alerta(controller: self).erro("Desculpe!", message: self.usuarioAtual.msgError)
print(self.usuarioAtual.msgError)
self.myProgress.hidden = true
self.myProgress.stopAnimating()
}
})
}
I believe that what the Xcode is saying is null is the navigationController
, but do not know why, I use this same structure to pass the other screens and work, even yesterday was working normally, no changes appeared this error.
Which line it shows this message ?
– Gabriel Rodrigues