Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9096281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T23:48:22+00:00 2026-06-16T23:48:22+00:00

I have tableview with search result controller when search in search bar get this

  • 0

I have tableview with search result controller when search in search bar get this error indicate that there is no cell and get the below error .How can create my prototype cell in this method CellForRowAtIndexPath

Code :

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath     *)indexPath
{
 static NSString *CellIdentifier = @"HoCell";
Ho *cell;
Ho *item;

if (tableView == self.searchDisplayController.searchResultsTableView) {
    if (cell == nil)
    {
        cell = [[Ho alloc]  initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"HoCell"];
    }
    item = [searchResultsController objectAtIndexPath:indexPath];
}
else{
    cell = (Ho*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    item = [fetchedResultsController objectAtIndexPath:indexPath];
}
cell.ho.text = item.name;

cell.selectedBackgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"se.png"]];

return cell;
}

Error :

*** Assertion failure in -[UISearchResultsTableView _configureCellForDisplay:forIndexPath:],  /SourceCache/UIKit_Sim/UIKit-2372/UITableView.m:5471
 Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:'
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T23:48:24+00:00Added an answer on June 16, 2026 at 11:48 pm

    There may be two possibilities Here :

    1) You are returning a number larger than your Array Count from
    tableView:numberOfRowsInSection:. Don’t.

    2) One or more of your cell# outlets is not hooked up in your nib, or
    is not hooked up to a UITableViewCell (or subclass). Hook them up
    properly.

    Go through this Ray Wenderlich’s Link :
    How to Add Search Into a Table View

    Check this SO Questions :

    1) UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath: Exception

    2) ios 5 UISearchDisplayController crash

    One More Beautiful Link : Custom Prototype Table Cells and Storyboards Just see this Portion :

    - (UITableViewCell *)tableView:(UITableView *)tableView
             cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
      UITableViewCell *cell = [tableView
                dequeueReusableCellWithIdentifier:UYLCountryCellIdentifier];
      if (cell == nil)
      {
        [self.countryCellNib instantiateWithOwner:self options:nil];
        cell = self.countryCell;
        self.countryCell = nil;
      }
      // Code omitted to configure the cell...
      return cell;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a search display controller in a table view. In this table view,
I have a tableview with a search display controller. It has been working fine
I have a tableview (linked to a database) and a search bar. When I
I have a search bar where you can search for cities/countries/places. I tested it
I have a table with a search bar. I find that when the search
Currently I have this code that changes the default background in a TableView to
i have uitableview and a search bar with searchDisplayController, i fill tableview datasource with
I have a search bar positioned above a tableview. The search functionality works great.
I have a UI table view with a search bar and it works well
I have one table view that should be filtered by values of search field

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.