0
Hello I am building an app that needs an alert to be presented as soon as the User accesses the screen.
For this I made a Viewcontroller and linked the view that is being accessed
class EducacaoController : UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
let alert = UIAlertController(title: "Atenção!", message: "oi", preferredStyle: .alert)
let acaoAvançar = UIAlertAction(title: "Avançar", style: .default, handler: nil)
alert.addAction(acaoAvançar)
self.present(alert, animated: true, completion: nil)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
Apparently I believe you’re right, but always present the message on the console:
2017-06-09 11:30:53.377951-0300 Issoebrasil[599:216652] Warning: Attempt to present on Whose view is not in the window Hierarchy!
Thanks Ricardo o/, solved
– Matheus Freitas