UITableView and UISearchDisplayController don't work with Storyboard prototype cells

Originator:futuretap
Number:rdar://16252999 Date Originated:06-Mar-2014 10:52 PM
Status:Closed/BehavesAsIntended Resolved:
Product:iOS SDK Product Version:7.1 beta 5
Classification:Serious Bug Reproducible:Always
 
When using a Storyboard with a UITableViewController with dynamic prototype cells, these cells aren't used in the searchResultsTableView of UISearchDisplayController.

Assuming that the UITableViewController is also the UISearchDisplayDelegate I'd expect that I could dequeue cells like this:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    return [tableView dequeueReusableCellWithIdentifier:@"MyCell" forIndexPath:indexPath];
}

So "tableView" would be either self.tableView or self.searchDisplayController.searchResultsTableView.

However, this returns nil cells in the searchResultsTableView case!

Note:
We can try to work around this bug  by always dequeuing the cells from self.tableView. Unfortunately, this raises an exception if the requested indexPath is not present in self.tableView as well.

Comments

see also

  • http://useyourloaf.com/blog/2012/09/06/search-bar-table-view-storyboard.html, scroll down to the "tableView:cellForRowAtIndexPath:" section.
  • http://stackoverflow.com/questions/14207142/assertion-failure-when-using-uisearchdisplaycontroller-in-uitableviewcontroller?rq=1#comment33767701_14221987

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!