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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:37:41+00:00 2026-05-20T10:37:41+00:00

I am running an update thread which updates a table using coredata. One of

  • 0

I am running an update thread which updates a table using coredata.
One of the records is called last-update. But when after the update is finished I retrieve the last-update value in the main thread I get an outdated value.

I do:

[NSFetchedResultsController deleteCacheWithName:nil];

before query-ing the setting again, but is there anything else I should/can do to alert the mainthread that it should check the physical table again?

  • 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-20T10:37:42+00:00Added an answer on May 20, 2026 at 10:37 am

    It sounds like you’re not syncing the updates back into the main thread’s NSManagedObjectController. Try adding a method like this:

    - (void)managedContextDidSave:(NSNotification *)n {
        if ([NSThread isMainThread]) {
            NSManagedObjectContext *context = /* Get context for main thread */;
            [context mergeChangesFromContextDidSaveNotification:n];
        } else {
            [self performSelectorOnMainThread:@selector(managedContextDidSave:) withObject:n waitUntilDone:YES];
        }
    }
    

    Then hook that up to the NSManagedObjectContextDidSaveNotification:

     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(managedContextDidSave:) name:NSManagedObjectContextDidSaveNotification object:nil];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After running a insert or update query against a SQLServer 2005 database, under what
I have a PL/SQL function (running on Oracle 10g) in which I update some
I'm working on a Swing application (currently running on Java 1.6 update 11) which
How can I check the umask of a program which is currently running? [update:
My question is : How can I update my UI while I'm running thread
We have an application with multiple subsystems running in different threads (ie one thread
I have a classic physics-thread vs. graphics-thread problem: Say I'm running one thread for
I currently have a long running thread which uses a hibernate session to perform
I'm running the following code to update the database according to the data I
I have a SQL update statement I am running from inside a PHP program.

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.