How can I do so the user gets taken to a custom view controller when he/she taps on "okay" button on alert?
I have a main controller -> navigation controller -> second view controller.
Main View Controller has a segue "mainStoryBoard" The alert gets generated on the second view controller.
This is what I have
let alertController = UIAlertController(title: "title", message: "message", preferredStyle: .alert)
alertController.addAction(UIAlertAction(title: "OK", style: .default, handler: { action
in self.performSegue(withIdentifier: "mainStoryBoard", sender: self)
}))
present(alertController, animated: true, completion: nil)
return
The error I am getting is the following:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver () has no segue with identifier 'mainStoryBoard'
I have set the identifier to 'mainStoryBoard' and still no luck.
Any guidance will be greatly appreciated.
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver (<udidtoolapp.Setup: 0x1014684b0>) has no segue with identifier 'mainStoryBoard''
– rob