0
votes

I'm with a little problem during the simulation in iOS Simulator. I'm studying table view, and, when i start the simulator, the XCode shows the message:

2012-08-08 14:08:41.606 TableView[731:f803] -[UIViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x68cc530 2012-08-08 14:08:41.641 TableView[731:f803] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x68cc530'

First throw call stack:

(0x13c8022 0x1559cd6 0x13c9cbd 0x132eed0 0x132ecb2 0x1f006b 0x1f2862 0xa066d 0xa0167 0xa3134 0xa7623 0x50d42 0x13c9e42 0x1d80679 0x1d8a579 0x1d0f4f7 0x1d113f6 0x1d9e160 0x10e84 0x11767 0x20183 0x20c38 0x14634 0x12b2ef5 0x139c195 0x1300ff2 0x12ff8da 0x12fed84 0x12fec9b 0x10c65 0x12626 0x20a2 0x2015) terminate called throwing an exception(lldb)

I don't have any idea about how to fix it... Could someone help me?

2
You should provide some code and some background about what you are trying to achieve. Unrecognized selector error usually occurs when you send a message to an object with a method that does not exist. Without any code, it could be multiple reasons for this happening. - Siddharth Dhingra
Did you implemented the numberOfRowsInSection method? if yes post it here so we can see - Eyal
A couple of possibilities come to mind. Either the view controller that you have set up as the data source for your table doesn't implement the required data source methods (see documentation for UITableViewDataSource) or you don't have the correct view controller subclass assigned in your xib or storyboard. - Phillip Mills
-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [arrayDeNomes count]; } - João Victor
i'm guessing that i will create another xib file , and start to work with him. - João Victor

2 Answers

1
votes

You have to correctly implement the @required methods from UITableViewDatasource and UITableViewDelegate protocols.

It seems that you didn't implement tableView:numberOfRowsInSection:, which is one of these required methods.

0
votes
 -[UIViewController tableView:numberOfRowsInSection:]

In your error message, means that the table view's datasource is connected to an instance of UIViewController, which doesn't implement this method.

You have forgotten to change the custom class of your view controller to the appropriate class in the storyboard / xib file, so it is still a plain UIViewController. Change it to whatever your custom view controller class is using the identity inspector.