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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:07:12+00:00 2026-06-05T02:07:12+00:00

In a subclass, whose instance is observed by another object: How to tell the

  • 0

In a subclass, whose instance is observed by another object: How to tell the observer that this instance has changed?

What i am trying to do is: I want a NSArrayController to get a notification when a property of some NSManagedObject (the controller manages) has changed. The controller should think the NSManagedObject has changed, but in fact one of its properties did.

  • 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-05T02:07:14+00:00Added an answer on June 5, 2026 at 2:07 am

    When setting the property of the managed object, use one of the property’s accessor methods (e.g., myObject.foo = bar or [myObject setFoo:bar]) or use KVC ([myObject setValue:bar forKey:@"foo"]). The latter is the only way for a plain NSManagedObject; being able to do the former is one of the advantages of subclassing NSManagedObject.

    You can post KVO notifications yourself, but this is only necessary when you’re assigning to instance variables (or using setPrimitiveValue:forKey:) directly, which you shouldn’t be doing except in a few cases:

    • (Ivars only) In init methods. You shouldn’t have any observers yet, so you shouldn’t worry about posting KVO notifications.
    • (Ivars only) In dealloc. You shouldn’t have any observers anymore, so you shouldn’t worry about posting KVO notifications. (If you do still have observers at this point, that is a bug in your code.)
    • (Both ivars and sPV:fK:) In custom accessors. You don’t need to post your own KVO notifications from custom accessors because KVO will do this for you. It also lets you set up dependencies, so you don’t need to post KVO notifications for other properties, either.

    (I’ve never gotten into Core Data, so I’d appreciate it if any Core Data experts could take a close look over my answer and make sure I haven’t gotten anything wrong or left anything out.)

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

Sidebar

Related Questions

I am trying to subclass the window that currently has focus. I do this
I have a UIView subclass ( CustomView for purposes of this question) that has
I'm trying to map an @Embeddable object in a subclass whose parent class already
I want to create a generic class, whose builder would not return an instance
I am trying to programmatically create a UIViewController subclass whose view includes some buttons,
I'm trying to implement a custom UISlider (subclass of UISlider), that behaves in a
I'm wondering why Java has this strange behavior regarding a superclass and a subclass
Is it possible to subclass dynamically? I know there's ____bases____ but I don't want
I'm trying to subclass the built-in file class in Python to add some extra
I have a subclass of UITableViewController. I have code that can add/remove a UISearchBar

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.