я получил UIAlertController, что я хотел бы представить в UITableViewController. Однако, когда я запускаю код, я получаю следующее сообщение об ошибке:Невозможно представить UIAlertController в UITableViewController в Swift
Warning: Attempt to present on whose view is not in the window hierarchy!
Мой код, кажется, отражают то, что предлагается в этом answer. Что я делаю не так?
override func viewDidLoad() {
super.viewDidLoad()
// Check for force touch feature, and add force touch/previewing capability.
if traitCollection.forceTouchCapability == .available {
registerForPreviewing(with: self, sourceView: view)
}
else {
// Create an alert to display to the user.
alertController = UIAlertController(title: "3D Touch Not Available", message: "Unsupported device.", preferredStyle: .alert)
self.present(alertController!, animated: false, completion: nil)
}
Возможный дубликат [чей вид не находится в иерархии окон] (http://stackoverflow.com/questions/11862883/whose-view-is-not-in-the -window-иерархия) – Adarkas2302