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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:10:27+00:00 2026-05-22T17:10:27+00:00

I have an NSArrayController linked to a Core Data object, set to Auto Rearrange

  • 0

I have an NSArrayController linked to a Core Data object, set to Auto Rearrange Content and filtered by a predicate. All is well until I try to nullify a relationship and assign another. At that point, my application crashes and I receive the following error:

Cannot remove an observer
for
the key path “career.type”
from Object, most likely
because the value for the key “career”
has changed without an appropriate KVO
notification being sent. Check the
KVO-compliance of the Person class.

From snooping around, it appears that having my NSArrayController set to Auto Rearrange Content causes this issue. But I’m trying to resolve the problem without having to resort to manually rearranging the NSArrayController. Here’s the pseudo-code that’s triggering the error:

object.career = nil;
object.field = (Field *)item;

Here’s the predicate my NSArrayController is using:

(career != NIL && career == %@) || (field != NIL && field == %@)

Where %@ for both instances is a CoreData object.

Basically, it looks as though the NSArrayController has an observer set for object.career.type and nullifying the relationship causes an issue when that observer is automatically removed. So I’m wondering if I’m going about this the wrong way? Should I be grabbing a copy of the object, deleting it from the MOC and reinserting it with career set to nil and field set accordingly?

How do I correctly notify the observer that type has been nullified? Note that all attributes and relationships mentioned here use vanilla KVO-compliant getters/setters.

  • 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-22T17:10:27+00:00Added an answer on May 22, 2026 at 5:10 pm

    From apples documentation

    Faults and KVO Notifications

    When Core Data turns an object into a fault, key-value observing (KVO) change notifications (see Key-Value Observing Programming Guide) are sent for the object’s properties. If you are observing properties of an object that is turned into a fault and the fault is subsequently realized, you receive change notifications for properties whose values have not in fact changed.

    Although the values are not changing semantically from your perspective, the literal bytes in memory are changing as the object is materialized. The key-value observing mechanism requires Core Data to issue the notification whenever the values change as considered from the perspective of pointer comparison. KVO needs these notifications to track changes across key paths and dependent objects.


    So basically you will get an notification telling you there’s a change even if it’s not. So you got to check if the object has become an fault. Then remove the old observer and add a new to the same path…

    For me this worked (sample code):

    - (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
        [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
    
        if ([keyPath isEqualToString:@"pageIndex"]) {
    
            // basically remove the observer from the fault object and assign the new
            if([object isFault]) {
                [object removeObserver:self forKeyPath:@"pageIndex"];
                [the_current_instance_returned_by_core_data addObserver:self forKeyPath:keyPath options:NSKeyValueObservingOptionOld context:NULL];
            } 
    
            // do whatever you want to do on change...
    
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a NSArrayController whose content property is (programmatically) set to an NSMutableDictionary
I have some trouble with a core data project. I have a NSArrayController with
I have an NSArrayController, companiesController bound to a top level Core Data entity, Companies
Context: I have an NSArrayController tied to Core Data that supplies rows for an
I have an NSTableView bound to a core-data-backed NSArrayController by binding individual columns to
In my small Core Data application I have some NSTableView views binded with NSArrayController
I have a NSArrayController with following Object: @interface AdressCard : NSObject <NSCoding> { NSString*
I have an NSArrayController which is bound to a class in my Managed Object
I have a question about Core Data. When starting my appliction, when is my
All right, after having worked through Cocoa Dev Central's Build a Core Data Application

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.