Unrecognized selector sent to instance” error?

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.

Up vote 0 down vote favorite share g+ share fb share tw.

Part of my AppDelegate code is: UITabBarController *tabBarController = (UITabBarController *)self.window. RootViewController; UINavigationController *navigationController = tabBarController viewControllers objectAtIndex:0; PilotosViewController *playersViewController = navigationController viewControllers objectAtIndex:0; playersViewController. Drivers = players; But I get this exception: -UIViewController viewControllers: unrecognized selector sent to instance 0x6a75770 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-UIViewController viewControllers: unrecognized selector sent to instance 0x6a75770' Where is the mistake?

Objective-c ios uiviewcontroller link|improve this question edited Mar 20 at 12:39Anna Karenina16.3k22128 asked Mar 20 at 10:30El Sinior X111.

The error says that you sent viewControllers to a UIViewController instance, but your code snippet only shows a UITabBarController and UINavigationController instances receiving that message. – Peter M Mar 20 at 12:44.

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.

I met the same issue , because I followed the steps by the author, but UINavigationController *navigationController = tabBarController viewControllers objectAtIndex:0; this is what made the crash, becuase navigationController is not at index=0, I did exchange the locations of the two tab bar items , then it works .

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions