Warning: Attempt to present * on * whose view is not in the window hierarchy - swift

前端 未结 17 992
花落未央
花落未央 2020-11-30 22:03

I\'m trying to present a ViewController if there is any saved data in the data model. But I get the following error:

Warning: A

17条回答
  •  野性不改
    2020-11-30 22:20

    I have tried so many approches! the only useful thing is:

    if var topController = UIApplication.shared.keyWindow?.rootViewController
    {
      while (topController.presentedViewController != nil)
      {
        topController = topController.presentedViewController!
      }
    }
    

提交回复
热议问题