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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:30:17+00:00 2026-06-17T21:30:17+00:00

For a long time I’ve been getting a strange bug where most of my

  • 0

For a long time I’ve been getting a strange bug where most of my table view becomes black (only a few cells remain http://cl.ly/LFlS) and in other views (connected to the same MOC) some other visual glitches appear: http://cl.ly/LH3c (notice the duplicate section headers). I always figured it was a bug with CoreData but I never got to reproduce it until today while it was hooked to the debugger. Here’s the exception I got right before it happened:

CoreData: error: Serious application error. An exception was caught
from the delegate of NSFetchedResultsController during a call to
-controllerDidChangeContent:. * -[__NSArrayM insertObject:atIndex:]: object cannot be nil with userInfo (null)

It stopped on the [tableView endUpdates] line in my controllerDidChangeContent: method. Then if I click continue, the app doesn’t crash, but user interaction becomes extremely sluggish. I looked all over the place as of what might be the cause of that exception and couldn’t find anything. Any clue?

My NSFetchedResultsController change handling looks pretty much like Apple’s boilerplate. The init of my NSFRC looks like this:

NSFetchRequest *request = [[NSFetchRequest alloc] init];

NSEntityDescription *entity = [NSEntityDescription entityForName:@"Artist" inManagedObjectContext:[SWDataManager sharedManager].mainObjectContext];
[request setEntity:entity];

[request setFetchBatchSize:100];

NSSortDescriptor *sortByName = [[NSSortDescriptor alloc] initWithKey:@"sortName" ascending:YES selector:@selector(localizedCaseInsensitiveCompare:)];
[request setSortDescriptors:@[sortByName]];

fetchedResultsController = [[NSFetchedResultsController alloc]
                            initWithFetchRequest:request
                            managedObjectContext:mainObjectContext
                            sectionNameKeyPath:@"firstLetter"
                            cacheName:nil];

fetchedResultsController.delegate = self;
[self refreshDataSource]; // set fetch request predicate and call performFetch on NSFRC
return fetchedResultsController;

EDIT: I can add that this definitely happened after that a bunch of objects got deleted from my MOC and therefore from the table view.

As requested, my controllerDidChangeContent: code:

- (void)controllerDidChangeContent:(NSFetchedResultsController *)controller {
    [self.tableView endUpdates];

    // this updates the section index and footer cell and other kind of stuff
    [self performSelector:@selector(layoutSpecialCells) withObject:nil afterDelay:0.3];
}
  • 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-17T21:30:18+00:00Added an answer on June 17, 2026 at 9:30 pm

    I ended up requesting a TSI with Apple and here’s the gist of the answer I got:

    To protect the integrity of the datastore, Core Data catches some
    exceptions that happen during it’s operations. Sometimes this means
    that if Core Data calls your code through a delegate method, Core Data
    may end up catching exceptions your code threw.

    In this case, Core Data caught an exception through from your
    -controllerDidChangeContent: method, caused by trying to use -insertObject:atIndex to put nil into an NSMutableArray.

    So basically that exception is thrown by my code, and not necessarily by the Core Data framework. I still couldn’t find the root cause of the exception, so the advice:

    Multi-threading errors are the most common cause of mysterious Core Data issues.

    went a long way and I realized some of my Core Data code wasn’t encapsulated inside performBlock: calls. Once I got that fixed, I never saw the issue happen again.

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

Sidebar

Related Questions

I've been a long time browser here, but never have had a question that
For a long time I've been designing applications using Interface/Inheritance based polymorphism, to gain
Been a long time since I have touched regular expressions. It's simple but I
First time poster long time reader. I've been playing round with reading in data
A long time ago, I bought a data structures book off the bargain table
Long time reader first time typer. I've been trying to setup a simple spring3
Long time lurcher, first time poster here. I've been grappling with this problem for
long time lurker here, been using the advice from this site for years, and
Long time ago I made a socket based server application using the principle of
(Long time reader of SO, first time asking a q. I'm quite new to

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.