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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:36:27+00:00 2026-05-13T18:36:27+00:00

Fairly new to iPhone dev. My app uses Core Data, and at one point

  • 0

Fairly new to iPhone dev. My app uses Core Data, and at one point I’m attempting to save some data during an NSFetchedResultsControllerDelegate method:

- (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject
   atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type
  newIndexPath:(NSIndexPath *)newIndexPath {

I’m getting most of this right out of Apple’s documentation on the subject. The delete action looks like so:

case NSFetchedResultsChangeDelete:
        [managedObjectContext deleteObject:anObject];
        NSError *error;
        if (![managedObjectContext save:&error]) {
            NSLog(@"WTF? %@", [error description]);
        }
        [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]
                         withRowAnimation:UITableViewRowAnimationFade];
        break;

Now, when I do this, the object in question will be deleted after the inevitable crash. So something right is happening. The crash is interesting, though:

Serious application error. Exception was caught during Core Data change processing:Failed to process pending changes before save. The context is still dirty after 100 attempts. Typically this recursive dirtying is caused by a bad validation method, -willSave, or notification handler. with userInfo (null)

2010-02-09 23:02:03.931 app2[26664:207] *** Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ‘Failed to process pending changes before save. The context is still dirty after 100 attempts. Typically this recursive dirtying is caused by a bad validation method, -willSave, or notification handler.’

My research has turned up some very limited results — good thing I have here to document this, eh? 🙂 But my gut is saying that the MOC is being written to elsewhere in my controller, though I can find no evidence of that happening. The viewDidLoad method has the NSFetchedResultsController being used to get the initial data, but that’s it.

Any suggestions on what might be wrong here? As usual, your community-based hive mind is very much appreciated!

Cheers, Aaron

  • 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-13T18:36:27+00:00Added an answer on May 13, 2026 at 6:36 pm

    (If I understand the problem correctly)
    I think all you need to do in this case is:

    case NSFetchedResultsChangeDelete:
    
            [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]
                             withRowAnimation:UITableViewRowAnimationFade];
            break;
    

    Remember that method

    - (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type newIndexPath:(NSIndexPath *)newIndexPath 
    

    is notified after the underlying data has changed. So I believe your object is already deleted, you don’t need to delete it manually. All that is left to be done in this method is remove it from the tableView.

    Hope this helps!

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

Sidebar

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.