Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Unrecognised selector sent to instance

I'm having problems with a tutorial I am watching on the UINavigationController and TableView.


The link is here:


http://www.youtube.com/watch?v=vY8tQQn4evo


Everybody seems to be saying, great, thanks, worked perfectly, etc. But everytime I try to implement about the first 10 mins of the video I get an unrecognised selector sent to instance 0x71788a0 to the UIViewController tableView: numberOfRowsInSection, which there clearly isn't a problem with as I've tried a new projects following the same proceedures.


I've tried relinking the table to files owner, all the usual troubleshootng tecniques and the same error is outputted. The only thing differerent to all my other practice/tutorial projects is the way the ViewController and UINavigationController get loaded into the UIWindow:



#import "AppDelegate.h"

#import "ViewController.h"



@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

{

self.window = [[UIWindowalloc] initWithFrame:[[UIScreenmainScreen] bounds]];

// Override point for customization after application launch.

UIViewController *viewController = [[UIViewControlleralloc] initWithNibName:@"ViewController"bundle:nil];

UINavigationController *navController = [[UINavigationControlleralloc]initWithRootViewController:viewController];

self.window.backgroundColor = [UIColorwhiteColor];

self.window.rootViewController = navController;

[self.windowmakeKeyAndVisible];

returnYES;

}

Posted on Apr 20, 2013 6:51 AM

Reply
Question marked as Best reply

Posted on Apr 20, 2013 8:05 AM

Are you sure your method is defined exactly like this:


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
...
...
...
}
20 replies

Apr 20, 2013 3:58 PM in response to !#

Thanks, yes I definately have the method typed correctly:


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {


return 3;

}


Here is the exception:


2013-04-20 23:57:44.206 NavigationLogic[1357:11303] -[UIViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x74563c0

2013-04-20 23:57:44.208 NavigationLogic[1357:11303] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x74563c0'

Apr 20, 2013 4:11 PM in response to xnav

My VC and .xib is named ViewController


The instance name for the ViewController is called *viewController and the UINavigationController instance is called *navController as stated in my first post.


I think its very strange if lots of people on YouTube say OK, this works well, etc. ?? I've tried starting 3 versions of this project and still the same sigabrt message 😠


I've also tried deleting the IOS simulator data and the derived data from within the organizer.


Thanks

Apr 21, 2013 5:59 AM in response to Daz1761

It is difficult to explain user interfaces. In the right hand window, you click on the 2nd little icon from the left, at the top. Then you change that class from UIViewController to your own ViewController class.


However, it is very difficult to give advice blindly like this. I have no idea what you are doing. Even if I wanted to watch that video it would not help to find where you have deviated from it.


I strongly suggest you stop using YouTube and use Apple's tutorials instead.

Unrecognised selector sent to instance

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.