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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:37:05+00:00 2026-06-11T11:37:05+00:00

I make a program where I sometimes moves some anchor to another When I

  • 0

I make a program where I sometimes moves some anchor to another

When I move those anchors I would recompute distance of bizs nearby the 2 anchors (before and after anchors). The computation is done in background

I used this standard code to update stuff

+(void)commit {
    // get the moc for this thread

    [Tools breakIfLock];
    NSManagedObjectContext *moc = [self managedObjectContext];
    NSThread *thread = [NSThread currentThread];

    DLog(@"threadKey commit%@" , [[self class]threadKey]);

    if ([thread isMainThread] == NO) {
        // only observe notifications other than the main thread
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(contextDidSave:) name:NSManagedObjectContextDidSaveNotification object:moc];
    }

    NSError *error;
    if (![moc save:&error]) {
        CLog(@"Error in Saving %@", error);
        DLog(@"What the hell error is it");
    }
    else{

    }

    if ([thread isMainThread] == NO) {
        [[NSNotificationCenter defaultCenter] removeObserver:self name:NSManagedObjectContextDidSaveNotification object:moc];
    }
    //[GrabClass StopNetworkActivityIndicatorVisible];

}

+(void)contextDidSave:(NSNotification*)saveNotification {

    dispatch_async(dispatch_get_main_queue(), ^{
        BadgerNewAppDelegate *delegate = [BNUtilitiesQuick appDelegate];
        DLog (@"currentThreadinContextDidSave: %@",[self threadKey]); 
        NSManagedObjectContext *moc = delegate.managedObjectContext; //delegate for main object
        CLog(@"saveNotification : %@",saveNotification);
        [moc mergeChangesFromContextDidSaveNotification:saveNotification];
    });


    //[moc performSelectorOnMainThread:@selector(mergeChangesFromContextDidSaveNotification:) withObject:saveNotification waitUntilDone:YES];
}

I break point and see that distances did get updated. Everything is fine

However the NSFetchedResultsController fetchedObjects doesn’t seem to get updated and still use the old value.

How can that be?

Also the

- (void)controllerWillChangeContent:(NSFetchedResultsController *)controller {
    DLog(@"controllerWillChangeContent: %@", controller);
    [self.tableViewA beginUpdates];
}

is never called even though the NSManagedObjectContext has changes.

Well actually I wasn’t sure if the managedObjectContext has changed or not. How do I know? I mean will change in managedObjectContext ensure changes in fetchController.fetchedObjects.

There is no caching as far as I know. How can I be sure of that too?

  • 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-11T11:37:07+00:00Added an answer on June 11, 2026 at 11:37 am

    The NSFetchedResultsController documentation for fetchedObjects property states:

    The results array only includes instances of the entity specified by
    the fetch request (fetchRequest) and that match its predicate. (If the
    fetch request has no predicate, then the results array includes all
    instances of the entity specified by the fetch request.)

    The results array reflects the in-memory state of managed objects in
    the controller’s managed object context, not their state in the
    persistent store. The returned array does not, however, update as
    managed objects are inserted, modified, or deleted.

    Availability Available in iOS 3.0 and later.

    I can’t say what the appropriate workaround is. My first thought is to call performFetch: in controllerDidChangeContent: in the delegate implementation.

    The fetchedObjects array appears to update simply by overriding controllerDidChangeContent: with an empty implementation. This is the case using both the iPad and the iPad simulator for iOS 5.1.

    There’s clearly some discrepancy between the documentation and what I have observed. I have no explanation. Sorry. I can only suggest that you perform the fetch in controllerDidChangeContent: just to be safe.

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

Sidebar

Related Questions

I want to make a program which would compare 2 .csv files, and print
I want to make a program that will read some number in string format
I'd like to make program-wide data in a C++ program, without running into pesky
I make a program that shows a table. If people click the search I
I make this program :: #include<stdio.h> char *raw_input(char *msg); main() { char *s; *s
I want to make a program in Python that can take video input from
Im trying to make a program that retrieves an endless amount of numbers that
In order to make my program more streamlined (Without try and catch everywhere), I
I can make my program write a .dat file with an array of Node
I want to make a program that will simulate a user browsing a site

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.