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 4625216
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:14:24+00:00 2026-05-22T03:14:24+00:00

I have an table view where i am loaded custom cell from different nib,

  • 0

I have an table view where i am loaded custom cell from different nib, i am getting exception:

 2011-05-18 18:01:00.323 custInfoService[4370:20b] *** Assertion failure in -[UITableView _createPreparedCellForGlobalRow:withIndexPath:], /SourceCache/UIKit/UIKit-984.38/UITableView.m:4709
2011-05-18 18:01:00.324 custInfoService[4370:20b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:'
2011-05-18 18:01:00.325 custInfoService[4370:20b] Stack: (
    11125851,
    2442997307,
 

When i used breakpoint then i come to know the xception is in switch case.I am not able to figure out why its giving exception?? help me!
here is my code:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {


    static NSString *CellIdentifier = @"Cell"; 
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
    if (cell == nil) 
    { 
        [[NSBundle mainBundle] loadNibNamed:@"BookDetailViewController" owner:self options:NULL];
        cell = nibloadedcell;
       }

    tbcel.layer.cornerRadius = 10;
    tbcel.text = aBook.Name;


    UILabel *fieldlabel = (UILabel *) [cell viewWithTag:1];
    fieldlabel.text = [fieldarray objectAtIndex:(indexPath.row)];
    UILabel *valuelabel = (UILabel *) [cell viewWithTag:2];
    switch(indexPath.section)

    {
        case 0:
            valuelabel.text = aBook.Address;
            break;
        case 1:
            valuelabel.text = aBook.Phone;
            break;
        case 2:
             valuelabel.text = aBook.Purchase;
    }

    return cell;
}

  • 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-05-22T03:14:25+00:00Added an answer on May 22, 2026 at 3:14 am

    So the most obvious problem is that

    [[NSBundle mainBundle] loadNibNamed:@"BookDetailViewController" owner:self options:NULL];
    cell = nibloadedcell;
    

    is not setting your nibloadedcell outlet, so cell is nil all the way through. Hence no valid cell is returned, and you get the error UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:.

    Don’t forget, messages to nil are silently disregarded – the rest of the function can execute fine if cell is nil, and just not do anything!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have custom table view cell with images (loaded from app document directory), labels,
I have a UITableview made up with a custom cell loaded from a nib.
I have a grouped table view that utilizes two different custom table cells. When
I have TableView with a custom TableViewCell loaded from an external nib file. Each
I have table view navigation controller and the data is loaded from url. I
I have a table view controller with custom cells. In those cells i added
I have a TableView loading a custom cell and loading the data from a
I have a UITableView that uses custom cells, loaded from nibs, and hooked up
In my app, I use custom UITableViewCells loaded from a XIB. Each cell contains
I have a Table View Controller with cells. I want to update the text

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.