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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:22:02+00:00 2026-05-22T15:22:02+00:00

I have a window with a list full of Core Data objects, and a

  • 0

I have a window with a list full of Core Data objects, and a display window that opens when one is selected.

A certain action in the display window marks the Core Data objects as ‘Read’.

To open an object, I pass the object to the display window, and also the sortDescriptors and filterPredicate that displayed the list, so the display window can navigate forward/backwards (the main window sometimes displays a subset of objects, which is why I need the sortDescriptors and filterPredicate).

Marking the opened object as read works perfectly. It updates in the main window automatically thanks to KVO.

However, when I navigate forward/back to a different object in the display window, marking as read no longer works. I walk through the code and see the code execute, check the new value, and it is marked as read – but this doesn’t reflect in the main window, or in the database.

Is there anything obvious that could be causing this? I am not, at any point, creating a copy of the core data object. The display window uses an NSArrayController to fetch the data, and the sortDescriptors and filterPredicate are applied to it. My code to get the next object looks like this:

-(MyObject *object)nextObject {

    // _object is the object being displayed by the display window.
    // _listContainingObject is an NSArrayController set to Entity: Object

    NSArray *list = [_listContainingObject arrangedObjects];

    NSUInteger positionInList = 0;
    for (MyObject *object in list) {

        if ([[[object objectID] URIRepresentation] isEqualTo: [[_object objectID] URIRepresentation]]) {            break;
        }
        positionInList++;
    }

    if (positionInList == [list count] - 1) return nil;

    if (positionInList + 1 > [list count] - 1) return nil;

    MyObject *object = [list objectAtIndex: positionInList + 1];

    return object;    

}

It really seems like I’m encountering some hidden gotcha of Core Data, like objects pulled out of a different NSArrayController are copies… but everything is running off the same ManagedObjectContext. The NSArrayController’s managed object context is bound to a property of my app delegate that returns the same context everything else uses. I am scratching my head pretty hard on this one.

  • 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-22T15:22:03+00:00Added an answer on May 22, 2026 at 3:22 pm

    remember that when you are working on the items, your managedObjectContext acts as a scratch pad. Your changes to your Managed Objects will not be reflected in the database until you actually save the Managed Object Context.

    So after you mark the item as read or unread, you need to save the context.

    NSError *saveContextError=nil;
    if (![yourManagedObjectContext save:&saveContextError){
        // Handle the error
        NSLog(@"managedObjectContext save error:  %@",error);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a window that is set with NSBorderlessWindowMask, and also kCGDesktopWindowLevel. When a
I'd like to add a drop-down list to a Windows application. It will have
I have a Window where I have put a Frame. I would like to
I have a window (derived from JFrame) and I want to disable the close
I have a window with 2 column grid. Left column contains a browser control
I have a window in WPF which shows some media contents. This content contains
I have a Window with my user control and I would like to make
More particularly - I have a window handle of another running application. This application
In my app have a window splitted by a QSplitter, and I need to
In my application I have a window which I popup with small messages on

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.