uitablleview crashes when link datasource
I am calling a view that contains a tableview and is showed properly until I link datsource to file's owner and generates following SIGABRT error. I do not understand what is happening because I had set tableview in other views and works! Problem is same as this thread because I am also using ASIHttprequest:
SIGABRT on startup
2011-10-13 00:53:36.633 Nimbo[1713:207] -[testViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x5c6fa30
2011-10-13 00:53:36.639 Nimbo[1713:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentExcept开发者_如何学运维ion', reason: '-[testViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x5c6fa30'
*** Call stack at first throw:
Have you implemented this method in you viewController:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
Because you are missing this required Delegate method view controller conformed to UITableViewDataSource protocol calls required method on your class since you havent implemented it it crashed. When you compiled your code likely you have gotten this as warning that you havent conformed to this protocol
Your testViewController
doesnt have a method called tableView:numberOfRowsInSection:
but somewhere in your code [testViewController tableView:numberOfRowsInSection:];
is being called. Please post the code where you are using testViewController
.
UITableView Class Reference:
- (NSInteger)numberOfRowsInSection:(NSInteger)section
Returns the number of rows (table cells) in a specified section.
Parameters
section
- An index number that identifies a section of the table. Table views in a plain style have a section index of zero.Return Value
The number of rows in the section.UITableView gets the value returned by this method from its data source and caches it.
精彩评论