whose view is not in the window hierarchy
dajdouj10 opened this issue · 2 comments
dajdouj10 commented
Warning: Attempt to present <UIAlertController: 0x7fc45081c800> on <App_iOS.AccueilViewController: 0x7fc44f507420> whose view is not in the window hierarchy!
JavierSolis commented
I have not looked in detail because it does not work, but try to call it another way and I showed it, instead of using .show (), use the self.present and it works!
let alert = UIAlertController (style: .actionSheet, title: "Date Picker", message: "Select Date")
alert.addDatePicker (mode: .dateAndTime, date: Date (), minimumDate: nil, maximumDate: nil) {date in
Log (date)
}
alert.addAction (title: "Done", style: .cancel)
//alert.show ()
self.present (alert, animated: true, completion: nil)
ahmetmvural1 commented
I have not looked in detail because it does not work, but try to call it another way and I showed it, instead of using .show (), use the self.present and it works!
let alert = UIAlertController (style: .actionSheet, title: "Date Picker", message: "Select Date") alert.addDatePicker (mode: .dateAndTime, date: Date (), minimumDate: nil, maximumDate: nil) {date in Log (date) } alert.addAction (title: "Done", style: .cancel) //alert.show () self.present (alert, animated: true, completion: nil)
thank you worked