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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:57:18+00:00 2026-06-04T18:57:18+00:00

I have specified a NSFetchtedResultsController as property… @property (nonatomic, strong) NSFetchedResultsController *controller; … and

  • 0

I have specified a NSFetchtedResultsController as property…

@property (nonatomic, strong) NSFetchedResultsController *controller;

… and set the delegate to my class.

self.controller.delegate = self;

Then I have implemented the in the headline mentioned method and put a breakpoint in it.

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

    => BREAKPOINT <=

    }

I have created the fetch request for the controller as follows:

  NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] initWithEntityName:@"Post"]; 
   // ... some sort ...
    self.controller = [[NSFetchedResultsController alloc]
                       initWithFetchRequest:fetchRequest
                       managedObjectContext:self.context
                       sectionNameKeyPath:nil
                       cacheName:@"cache"];

Now I am storing in another class in the same context some NSManagedObjects of the type “Post” but the didChangeObject method is never called (where my breakpoint is in it).

Does anyone know what is going wrong?

Update #1: The class which fetches some posts from a server and stores it into the context is executed asynchronously using GCD.

Update #2: I have tried it in another way due it does not work to use a context in a multithreaded environment. (Thanks to svena)
Now the ServerConnection runs in an async block (using GCD) and performs a selector on the main thread. This selector method stores the posts in the database and SHOULD update the tableview. Basically, I thought that when I store something in this context the didChangeObject method should be called automatically? But it does not. :-/

I have added a short sequence diagram to illustrate my current status.
sample sequence diagram
Does anyone know why this does not work? Please be patient. I am new to CoreData and Objective-C. 🙂

  • 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-04T18:57:19+00:00Added an answer on June 4, 2026 at 6:57 pm

    Update #1: The class which fetches some posts from a server and stores it into the context is executed asynchronously using GCD.

    if this is the case, how are you creating your managed object context for the GCD block?
    Neither contexts or managed objects are thread safe and cannot be passed around between threads. Furthermore changes made to context on one thread is not automatically propagated to contexts on other threads. Prior to iOS5 that means listening to NSManagedObjectContextDidSaveNotification and merging it there by using mergeChangesFromContextDidSaveNotification: method for your NSFetchedResultsController instance to see it.

    Great diagram by the way 🙂

    Could you please show the code at the points where you:

    1. Create your context
    2. Perform your block on the main thread to insert
      data
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have implemented the UrbanAirship in my App(with libUAirship-1.1.1.a). I have specified the values
In the grails class, I have specified BigDecimal amount to represent an amount of
I have specified my JAX-RS Application in the web.xml as follows: <servlet> <servlet-name>CXFServlet</servlet-name> <servlet-class>
Currently, JAXB is creating a point class from the xml schema I have specified.
I have a DataForm where I have specified a DataTemplate for ItemTemplate. ItemsSource is
I have follwowing peace of code in which I have specified the leaky line
I have a WCF service for which I have specified custom binding/readerQuotas settings. However,
I have used admob sdk and added as external jar.In xml i have specified
Background: I have a generic collection of type DirectoryCollection<T> and have specified that T
previously i had custom tableviewcell and was loading from Nib.in that i have specified

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.