MichaelQ
MichaelQ

Reputation: 26

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))

Upvotes: 1

Views: 1493

Answers (1)

LuKenneth
LuKenneth

Reputation: 2237

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

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

Upvotes: 4

Related Questions