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

  • Home
  • SEARCH
  • 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 8139499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T11:50:38+00:00 2026-06-06T11:50:38+00:00

I am using a NSFetchedResultsController in combination with a UIManagedDocument which gets updated in

  • 0

I am using a NSFetchedResultsController in combination with a UIManagedDocument which gets updated in an background thread.

I have set up the NSFetchedResultsController exactly as described in this tutorial: How To Use NSFetchedResultsController

I have set the delegate _fetchedResultsController.delegate = self and the protocol for my view controller to NSFetchedResultsControllerDelegate.

My code works fine when it loads the data after launch. However, the NSFetchedResultsController does not update the TableView whenever it has processed and saved the data in the background thread. In particular, the NSFetchedResultsController’s delegate methods -controllerWillChangeContent:controlleretc. are never being called.

I have double-checked that the SQLite database contains the data correctly.
This is how I process and save the data in the view controller:

[backgroundContext performBlock:^{
        [company parseAttributesFrom:xmlStr inManagedObjectContext:backgroundContext]; //self.managedDocument.managedObjectContext

        NSError *error = nil;
        [backgroundContext save:&error];
         if (error) NSLog(@"error: %@",error.localizedDescription);
        [self.managedDocument.managedObjectContext performBlock:^{
            NSError *error = nil;
            [self.managedDocument.managedObjectContext save:&error];
            if (error) NSLog(@"error: %@",error.localizedDescription);
        }];
        [self.managedDocument saveToURL:self.managedDocument.fileURL forSaveOperation:UIDocumentSaveForOverwriting completionHandler:NULL];
        [self.managedDocument updateChangeCount:UIDocumentChangeDone];
    }];

How can I get the NSFetchedResultsController to update the TableView automatically when the underlying data changes?

Thank you for your help!

  • 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-06T11:50:39+00:00Added an answer on June 6, 2026 at 11:50 am

    I think that reason is in managedObjectContext. You make changes in background, and NSFetchedResultsController fetches from the main one. So you need to merge changes to that one context by adding an observer of changes in context

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(contextChanged:) name:NSManagedObjectContextDidSaveNotification object:nil];
    

    Here is a great tutorial by Marcus Zarra – The Guru of Core Data)
    Hope that helps.
    http://www.cimgf.com/2011/08/22/importing-and-displaying-large-data-sets-in-core-data/

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

Sidebar

Related Questions

I have a NSFetchedResultsController which is fetching objects from a NSManagedObjectContext . I'm using
I have a NSFetchedResultsController which displays data in a UITableView. I'm using the boiler
I have a UIManagedDocument with some data which I display in a list using
I have a memory leak while using NSFetchedResultsController objectAtIndex: The stack frame is as
I am using an NSFetchedResultsController with a data source that is updated in the
I want to refetch data from my NSFetchedResultsController using a different predicate which is
I have setup a UITableView using a NSFetchedResultsController that displays a number of prototype
I've got a UITableView which is filled using a Core Data NSFetchedResultsController . I've
I am running an update thread which updates a table using coredata. One of
Please help with this issue of using NSFetchedResultsController. I created an object of 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.