SWIFT 2.2 警告:尝试在视图不在 window 层次结构中的 SignInViewController 上呈现 TabBar 控制器

SWIFT 2.2 Warning: Attempt to present TabBar Controller on SignInViewController whose view is not in the window hierarchy

我有一个 SignInVC,一个转换到 TabbarVC 的按钮 不是为了使用自定义转换而继续 。虽然它运行良好,但当我在调试区中按下登录按钮时,会弹出一个错误。

在 SignInVC 中

     @IBAction func onTapButton(sender: AnyObject) {

    btnFromNib.animate(1, completion: { () -> () in

        let myTabbarController = self.storyboard?.instantiateViewControllerWithIdentifier("myTabbarController") as! UITabBarController
        let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
        appDelegate.window?.rootViewController = myTabbarController

        myTabbarController.transitioningDelegate = self

        self.presentViewController(myTabbarController, animated: true, completion: nil)
    })

}

我做错了什么? ...

提前致谢

既然你正在改变你的 rootViewController 你不需要展示它..所以删除这一行

   self.presentViewController(myTabbarController, animated: true, completion: nil)