• 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: Mutable to-many relationship not observable
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mutable to-many relationship not observable


  • Subject: Re: Mutable to-many relationship not observable
  • From: Ken Thomases <email@hidden>
  • Date: Sat, 15 Jan 2011 02:19:58 -0600

On Jan 14, 2011, at 5:23 AM, Remco Poelstra wrote:

> I add the observer as follows:
> 	[[DigiDevicesManager sharedDigiDevicesManager] addObserver:self forKeyPath:@"digiDevices" options:NSKeyValueObservingOptionOld context:nil];
> It's superclass is NSObject and I did not disable automatic notifications.
>
> If mutate the array (from inside the observed object) with [self {will/did}change..] then everything works fine.

Which will/didChange... methods do you use, when you've tested the manual notifications?

Also, what does your -observeValueForKeyPath:ofObject:change:context: method look like?

My suspicion is that you're using will/didChangeValueForKey: and your observe... method is expecting the value of the NSKeyValueChangeKindKey to be NSKeyValueChangeSetting.

Instead, the automatic notifications from the mutating indexed accessors is more akin to what's generated by will/didChange:valuesAtIndexes:forKey:, and NSKeyValueChangeKindKey will be one of NSKeyValueChangeInsertion, NSKeyValueChangeRemoval, or NSKeyValueChangeReplacement.

Regards,
Ken

_______________________________________________

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: Mutable to-many relationship not observable
      • From: Remco Poelstra <email@hidden>
References: 
 >Mutable to-many relationship not observable (From: Remco Poelstra <email@hidden>)
 >Re: Mutable to-many relationship not observable (From: Mike Abdullah <email@hidden>)
 >Re: Mutable to-many relationship not observable (From: Remco Poelstra <email@hidden>)

  • Prev by Date: Re: Determining whether a dictionary is mutable or not
  • Next by Date: Re: NSSegmentedControl Label
  • Previous by thread: Re: Mutable to-many relationship not observable
  • Next by thread: Re: Mutable to-many relationship not observable
  • Index(es):
    • Date
    • Thread