MichaelQ MichaelQ - 3 months ago 9x
iOS Question

UIAlertController not showing

I'm trying to display a message to my users with alert controller but it wont show

let alert = UIAlertController(title: "Error", message: "Incorrect username/password", preferredStyle: UIAlertControllerStyle.Alert)
alert.addAction(UIAlertAction(title: "okay", style: UIAlertActionStyle.Default, handler: nil))


looks like you haven't presented it yet. paste this code where you want to show the alert

self.presentViewController(alert, animated: true, completion: nil)