I have a Search Display Controller
which displays the search results in a tableView and another tableView
made using IB in the same UIViewController
. The app worked fine until I added the code to populate the tableView I made using IB. But now when the app is launched, it is crashing by showing the following error:
'-[VBSAppDelegate tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0xae18480'
Following code is used to set the number of sections and number of rows in sections(yes, the very normal code)
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (tableView.tag == 100) {
return 60;
}
else {
return [filteredList count];
}
}
I have set two break points and discovered that for the tableView of search display controller it is getting into numberOfRowsInSection
and then getting terminated without even entering the cellForRowAtIndexpath
method. Any idea why this is happening? does it have anything to do with the second tableView? How to rectify this? Please ask if any further code is required. I am developing for iPad.
I solved the problem by disconnecting the delegate
and datasource
connections of the tableView I put in the xib
via IB, and then I connected is programmatically. It seems the problem was two delegate
and datasource
connected via IB causing confusion or something. Hope this helps someone who may be facing a similar issue. Just disconnect the delegate
and datasource
of the tableView that you inserted from IB and give it programatically.