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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:14:32+00:00 2026-05-13T23:14:32+00:00

I am using an NSFetchedResultsController to manage displaying fetched managed objects in a table

  • 0

I am using an NSFetchedResultsController to manage displaying fetched managed objects in a table view that has one section. The table starts out empty and the user can add new entities to it using the UI. As it stands, the program always works when adding the first entity, and always crashes when adding a second. There is sometimes no error presented upon the crash and other times there are errors of differing types (some included below). Through log statements and tracing I see that the program crashes just after the NSFetchResultsController’s delegate’s controllerWillChangeContent (which calls [self.tableView beginUpdates];) method exits, but before any other method in my code is called.
Here are some of the relavant parts of my code. Configuring the NSFetchedResultsController:

NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
[fetchRequest setEntity:[NSEntityDescription entityForName:@"Beer"
                                    inManagedObjectContext:self.managedObjectContext]];

// Configure request's entity and predicate
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES];
NSArray *sortDescriptors = [NSArray arrayWithObjects:sortDescriptor, nil];
[fetchRequest setSortDescriptors:sortDescriptors];
[sortDescriptor release];
[sortDescriptors release];

NSString *expression = [NSString stringWithFormat:@"brewery.name LIKE \"%@\"", self.brewery.name];
NSPredicate *predicate = [NSPredicate predicateWithFormat:expression];
[fetchRequest setPredicate:predicate];
self.resultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest
                                                             managedObjectContext:self.managedObjectContext
                                                               sectionNameKeyPath:nil
                                                                        cacheName:nil];
self.resultsController.delegate = self;
[fetchRequest release];

NSError *error = nil;
BOOL success = [resultsController performFetch:&error];
if (!success) {
    NSLog(@"Error fetching request %@", [error localizedDescription]);
}

Adding new entity:

NSEntityDescription *entity = [NSEntityDescription entityForName:@"Beer" inManagedObjectContext:self.managedObjectContext];
Beer *beer = [[Beer alloc] initWithEntity:entity insertIntoManagedObjectContext:self.managedObjectContext];
beer.name = beerName;
beer.brewery = self.brewery;

I have seen the warnings in the docs about problems displaying tables with one section, and I have used Apple’s workaround for that to no avail. Those methods aren’t getting called prior to the crash anyway.

Some of the errors I’ve received:

Serious application error.  Exception was caught during Core Data change processing: *** -[NSCFString compareObject:toObject:]: unrecognized selector sent to instance 0x4e808c0 with userInfo (null)
Serious application error.  Exception was caught during Core Data change processing: *** -[CALayer compareObject:toObject:]: unrecognized selector sent to instance 0x4e53b80 with userInfo (null)
Serious application error.  Exception was caught during Core Data change processing: *** -[UITextTapRecognizer controllerWillChangeContent:]: unrecognized selector sent to instance 0x4ca5d70 with userInfo (null)
Serious application error.  Exception was caught during Core Data change processing: *** -[CALayer controllerWillChangeContent:]: unrecognized selector sent to instance 0x4e271a0 with userInfo (null)
Serious application error.  Exception was caught during Core Data change processing: *** -[NSCFNumber countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance 0x4c96ee0 with userInfo (null)

As you can see, the errors (when one was presented) are not consistent, even when no change to the code was made.

Can anyone figure out what I’m doing wrong?

  • 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-13T23:14:33+00:00Added an answer on May 13, 2026 at 11:14 pm

    Your inconsistent errors point to a possible over-release issue. Especially since changing your delegates to just reload the data makes the issue go away. Personally I would invest the time to solve the issue rather than coding around it as you definitely having a code issue there that will probably show up later somewhere else.

    I would do the following:

    1. Turn on NSZombie
    2. Add a breakpoint for objc_exception_throw
    3. Run in the debugger

    When the exception occurs, look at the memory address and see what is being accessed and where. This will isolate the issue and tell you what is going on. It would also be helpful, if that does not reveal the issue, to post your NSFetchedResultsController delegate methods so I can see if there is anything strange in them.

    Best to update the original question with the additional information.

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

Sidebar

Related Questions

I am using an NSFetchedResultsController that uses a predicate to fetch some managed objects.
I am presenting table view contents using NSFetchedResultsController which has a predicate: [NSPredicate predicateWithFormat:@visible
I'm using NSFetchedResultsController for my table view. I call -performFetch inside my controller's -viewDidLoad
I'm using NSFetchedResultsController pretty much out-of-box in the way that the documentation describes. Here
When using the NSFetchedResultsController to create section headers for the UITableViewController the fetchedResultsController.sections has
Using C#, I need a class called User that has a username, password, active
I am using an NSFetchedResultsController with a data source that is updated in the
I am presenting a list of managed objects where each has a timeStamp property.
I've got a view with a TableView and an NSFetchedResultsController. I'm using a ASINetworkQueue
What's the best way to implement runtime filtering of Core Data objects using NSFetchedResultsController?

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.