Attempt to present UIAlertController on UIViewController whose view is not in the window hierarchy

后端 未结 1 1443
暖寄归人
暖寄归人 2021-01-13 00:11

I\'m trying to check the UIAlertController in iOS 9 for my sample application and while run it then I had found warning in console. I\'m using Xcode 7 and Objective C.

相关标签:
1条回答
  • 2021-01-13 01:01

    I guess, you are trying to present the alert on view did load. You get the error:

    Warning: Attempt to present < UIAlertController: 0x7fb1bb5be040 > on < ViewController: 0x7fb1bb5aef30 > whose view is not in the window hierarchy!

    because, in view did load the views are not yet available to display to the user. Hence you can't present the alert. Move the code into viewDidAppear

    0 讨论(0)
提交回复
热议问题