Reputation: 681
I have got the below piece of code :
let title = "You are not connected to DropBox"
let message = "Please go back to the main page and try to log in again"
let okText = "OK"
let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.Alert)
let okayButton = UIAlertAction(title: okText, style: UIAlertActionStyle.Cancel, handler: nil)
alert.addAction(okayButton)
if dbRestClient == nil{
print("please refresh me")
presentViewController(alert, animated: true, completion: nil)
}`
However my alert doesn't show up. I am calling this alert from a View Controller that actually shows on the page so its not the case where my VC is working behind the scene. Please let me know what I am doing wrong here.
Upvotes: 0
Views: 3025
Reputation: 98
Use self.presentViewController(alert, animated: true, completion: nil) instead.
Should work after adding self.
Upvotes: 1