• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSManagedObject subclass mysteriously notifies observers for non-modeled properties
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSManagedObject subclass mysteriously notifies observers for non-modeled properties


  • Subject: Re: NSManagedObject subclass mysteriously notifies observers for non-modeled properties
  • From: Mike Abdullah <email@hidden>
  • Date: Fri, 21 May 2010 14:10:30 +0100

What does +contextShouldIgnoreUnmodeledPropertyChanges return for your class? I am wondering if the two are interlinked.

On 21 May 2010, at 13:24, David Hoerl wrote:

> Before doing my latest project, I poured over the "Model Object Implementation Guide" and the NSManagedObject Class Reference. Both documents state categorically that NSManagedObjects do NOT automatically provide KVO notification unless one overrides +(BOOL)automaticallyNotifiesObserversForKey.
>
> So, I dutifully sent willChangeValueForKey and didChangeValueForKey in the setter method for my unmodeled property - an action that in the end caused a difficult to find KVO related bug. After commenting out these two statements, everything started working!
>
> Well, it thus became obviously that KVO was already enabled for this non-modeled property, so I added a log message to test this hypothesis:
>
> NSLog(@"AUTO=%d", [Template automaticallyNotifiesObserversForKey:@"topDSimObject"]);
>
> Sure enough it prints out AUTO=1!  Yikes! How did that happen?
>
>
> Here is my interface:
>
> @interface Template : NSManagedObject
> {
>   DSimObject  *topDSimObject;
> }
> @property (nonatomic, retain) NSString * name;
> ...
>
> // tried both as a property and not, no change
> //@property (nonatomic, retain) DSimObject* topDSimObject;
>
> - (void)setTopDSimObject:(DSimObject *)object;
> - (DSimObject *)topDSimObject;
>
> @end
>
>
> So, what am I missing?
>
> David
>
>
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSManagedObject subclass mysteriously notifies observers for non-modeled properties
      • From: David Hoerl <email@hidden>
References: 
 >NSManagedObject subclass mysteriously notifies observers for non-modeled properties (From: David Hoerl <email@hidden>)

  • Prev by Date: Re: scriptability of button in interface?
  • Next by Date: controlAlternatingRowBackgroundColors
  • Previous by thread: NSManagedObject subclass mysteriously notifies observers for non-modeled properties
  • Next by thread: Re: NSManagedObject subclass mysteriously notifies observers for non-modeled properties
  • Index(es):
    • Date
    • Thread