“Unrecognized selector sent to instance” error

前端 未结 3 1012
走了就别回头了
走了就别回头了 2021-01-14 07:09

Part of my AppDelegate code is:

UITabBarController *tabBarController 
    = (UITabBarController *)self.window.rootViewController;

UINavigationController *na         


        
3条回答
  •  梦谈多话
    2021-01-14 07:38

    You need to make sure that you connect things properly in your XIB or storyboard. The exception is showing you that the object is of type ViewController when you send [tabBarController viewControllers] and you were expecting a UITabBarController. That's why you're getting '-[ViewController viewControllers]:. Make sure that your root view controller really is a tab view controller.

提交回复
热议问题