My iOS app is crashing when I run the following line of code after the push of a standard UIButton:
self.performSegueWithIdentifier("loginAttempt", sender: self)
The segue identifier name is correct as I copied and pasted the name from the sidebar into the code. Upon remove the code the app stops crashing when the button is pressed.
The error I get is:
Thread 1: EXC_BREAKPOINT (code=1, subcode=0x1002544fc)
And in the Output box:
fatal error: unexpectedly found nil while unwrapping an Optional value
error is somewhere else but for clearity.
1)put breakpoint on seguing line and note is control is reaching to segue line.
Or
2) following put your segue for testing:
override func viewDidAppear(animated: Bool) {
self.performSegueWithIdentifier("loginAttempt", sender: self)
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {
if (segue.identifier == "loginAttempt") {
print("Hi segue is working")
}
}
if it prints line then segue is working .