tardoandre tardoandre - 1 year ago 82
iOS Question

Why is my UIAlertController not being fired?

I want to display a

whenever user opens the application.

This is how I'm creating and trying to show it:

import UIKit

class ViewController: UIViewController {

override func viewDidLoad() {

//simple alert dialog
let alert=UIAlertController(title: "Alert 1", message: "One is awesome", preferredStyle: UIAlertControllerStyle.Alert);
//show it
showViewController(alert, sender: self);


Why is it not being displayed?

Answer Source

It will work if you'd use: presentViewController(alert, animated: true, completion: nil)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download