MichaelQ MichaelQ - 1 year ago 116
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))

Answer Source

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)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download