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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:24:57+00:00 2026-05-26T18:24:57+00:00

I have a Core Data backed table view, that show a list of editable

  • 0

I have a Core Data backed table view, that show a list of editable fields, for different field types I have different UTableViewCells with different cell identifiers. When I scroll too quickly in the simulator or try to “bounce” past the last cell, I get a crash, saying that UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath. The whole problem goes away if I remove the dequeueReusableCellWithIdentifier: steps. Which means my table view is less efficient. I’m at most using 20 fetched objects (more along the lines of 8-10) in my table view, so the inefficiency might be a minor issue. I’d just like to know if I’m doing something the wrong way.

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

    Field *aField = [self.fetchedResultsController objectAtIndexPath:indexPath];
    static NSString *CellIdentifier = @"Cell";
    static NSString *ChoiceIdentifier = @"ChoiceCell";
    static NSString *SwitchIdentifier = @"SwitchCell";

    UITableViewCell *cell;

    if ([aField.fieldType isEqualToString:@"choice"] || [aField.fieldType isEqualToString:@"date"]  || [aField.fieldType isEqualToString:@"multiChoice"] ) {

        NSLog(@"ChoiceCell");
        cell = [tableView dequeueReusableCellWithIdentifier:ChoiceIdentifier];
        if (cell == nil) {
            if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
                [[NSBundle mainBundle] loadNibNamed:@"ChoiceTableViewCell-iPad" owner:self options:nil];
            } else {
                [[NSBundle mainBundle] loadNibNamed:@"ChoiceTableViewCell" owner:self options:nil];
            }
        }

    } else if ([aField.fieldType isEqualToString:@"boolean"]){

        NSLog(@"SwitchCell");
        cell = [tableView dequeueReusableCellWithIdentifier:SwitchIdentifier];
        if (cell == nil) {

            if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
                [[NSBundle mainBundle] loadNibNamed:@"SwitchTableViewCell-iPad" owner:self options:nil];
            } else {

                [[NSBundle mainBundle] loadNibNamed:@"SwitchTableViewCell" owner:self options:nil];
            }
        }


    } else {

        NSLog(@"Cell");
        cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
        if (cell == nil) {
            if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
                [[NSBundle mainBundle] loadNibNamed:@"EditableTableViewCell-iPad" owner:self options:nil];
            } else {

                [[NSBundle mainBundle] loadNibNamed:@"EditableTableViewCell" owner:self options:nil];
            }
        }
    } 

    cell = editableCell;
    self.editableCell = nil;


    // Configure the cell...
    [self configureCell:cell atIndexPath:indexPath];
    return cell;
}

Additional Details: The editableCell is being set as in each of the NIBs that correspond to the custom cells. I tried more directly setting this by saying

dynamicCell = [[[NSBundle mainBundle] loadNibNamed:@"ChoiceTableViewCell-iPad" owner:self options:nil] objectAtIndex:0];

but still had the same problem. It should never return nil. The all the NIBs are being loaded as long as I don’t scroll too fast. I’ve double and triple checked the NIB names to make sure.

Here’s the updated working code:

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

{

Field *aField = [self.fetchedResultsController objectAtIndexPath:indexPath];
static NSString *CellIdentifier = @"Cell";
static NSString *ChoiceIdentifier = @"ChoiceCell";
static NSString *SwitchIdentifier = @"SwitchCell";


if ([aField.fieldType isEqualToString:@"choice"] || [aField.fieldType isEqualToString:@"date"]  || [aField.fieldType isEqualToString:@"multiChoice"] ) {

    NSLog(@"ChoiceCell");
    dynamicCell = [tableView dequeueReusableCellWithIdentifier:ChoiceIdentifier];
    if (dynamicCell == nil) {
        if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {


            [[NSBundle mainBundle] loadNibNamed:@"ChoiceTableViewCell-iPad" owner:self options:nil];
        } else {
            [[NSBundle mainBundle] loadNibNamed:@"ChoiceTableViewCell" owner:self options:nil];
        }
    }

} else if ([aField.fieldType isEqualToString:@"boolean"]){

    NSLog(@"SwitchCell");
    dynamicCell = [tableView dequeueReusableCellWithIdentifier:SwitchIdentifier];
    if (dynamicCell == nil) {

        if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
            [[NSBundle mainBundle] loadNibNamed:@"SwitchTableViewCell-iPad" owner:self options:nil];
        } else {

            [[NSBundle mainBundle] loadNibNamed:@"SwitchTableViewCell" owner:self options:nil];
        }
    }


} else {

    NSLog(@"Cell");
    dynamicCell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (dynamicCell == nil) {
        if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
            [[NSBundle mainBundle] loadNibNamed:@"EditableTableViewCell-iPad" owner:self options:nil];
        } else {

            [[NSBundle mainBundle] loadNibNamed:@"EditableTableViewCell" owner:self options:nil];
        }
    }
} 

UITableViewCell *cell;
cell = dynamicCell;
self.dynamicCell = nil;


// Configure the cell...
[self configureCell:cell atIndexPath:indexPath];
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-26T18:24:58+00:00Added an answer on May 26, 2026 at 6:24 pm

    Looks like the problem is with:

    cell = editableCell
    

    if editableCell is nil your app will crash. I assume you intend editableCell to be set by loadNibNamed:. It is not set if you dequeue a cell.

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

Sidebar

Related Questions

I have an app, backed by Core Data, that I've been working on for
I have a Core Data based mac application that is working perfectly well until
In my core data model I have a Person entity that has a to
Im trying to create a listing app that is core data backed.The first page
I have a core-data object entity with 2 fields - name (a NSString *)
I am trying to implement a Core Data backed UITableView that supports indexing (eg:
I have a core data model that has two entities, Bid and Result. I
I have two Core Data entities ( Client and UserFile ) that I have
I currently have a SQLite backed Core Data app where I am fetching records
I'm trying to make my Core data backed UITableView have reorder ability, After implement

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.