You need to discover out what is yourCurrent/Topmostview controller in check out hierarchy and present her alert end it.

To discover out topmost check out controller use complying with code:

func getTopMostViewController() -> UIViewController? var topMostViewController = UIApplication.shared.keyWindow?.rootViewController while allow presentedViewController = topMostViewController?.presentedViewController topMostViewController = presentedViewController return topMostViewControllerAnd present your alert over topmost watch controller and also use main thread to existing an alert due to the fact that closures may have actually working on one more thread.

DispatchQueue.main.async getTopMostViewController()?.present(alertController, animated: true, completion: nil)


You are watching: Whose view is not in the window hierarchy!

*
answeredJun 2Aurelia Maja98.6k pointseditedJun 9by Aurelia Maja

Your discuss this answer:

Your name to display screen (optional):
Email me in ~ this address if a comment is added after mine:Email me if a comment is added after mine

Problem: Warning: effort to present on whose see is not in the home window hierarchy.This is the output that ns am gaining for the alertview now showing up. I have looked at every the various other posts around this exact same issue however none seem to work.What have the right to i do?
askedMay 2sumaiya simi43.9k points
Problem: just started making use of Xcode 4.5 and also I obtained this error in the console: Warning: attempt to existing on whose see is not in the window hierarchy!
*
askedMar 9ummesalma29.1k points
*
askedAug 31akhi179k points
Problem: I"m seeking for a solution and also would appreciate some help and assistance : check out controller is unreachable due to the fact that it has no entry points
*
askedJun 22asha183k points
Problem: I should update status bar style on every view controller based upon the background color (what UINavigationController is act automatically). Have actually tried every the choices described ~ above stackoverflow (View controller-based standing bar appearance in info.plist collection to YES), but none functioned for me.
Problem: has anyone had actually this complication before : just how to pass variables between view controllers swift?


See more: Gugudan'S Kim Sejeong Running Man, 270 Best Show To Ever Exist!! Ideas

Problem: Error: ViewDestroyedError: attempt to usage a damaged view: detectChanges at viewDestroyedError I obtain this error as soon as going to one more page if trying come trigger change detection by using detectChanges method in a component. I uncovered that ns don"t get the error ... ) this.somethingService.getData().subscribe(data => this.data = data; this.changeDetector.detectChanges(); ); }