Skip navigation.
 
mlRe: NSArrayController bound to @unionOfArrays not updating
FROM : Quincey Morris
DATE : Thu Apr 17 21:29:24 2008

On Apr 17, 2008, at 10:31, mmalc crawford wrote:

> On Apr 17, 2008, at 9:36 AM, Quincey Morris wrote:

>>> Just so I understand, should I surround calls to any of the 
>>> standard KVC method calls (in my case, insertObject:atIndex:) with 
>>> [self willChangeValueForKey:@"affectedKey"]; and [self 
>>> didChangeValueForKey:@"affectedKey"] if the standard KVC call will 
>>> affect that derived property?  This is probably described in the 
>>> KVO documentation, I'll read up on it to make sure.  Thanks for 
>>> the quick fix.

>>
>> Well, the answer is a qualified "yes".
>>

> No, the answer to the question as posed is "no" (subsequent "*But*"s 
> in the answer notwithstanding).
> If you want to emit KVO notifications for collection mutations, you 
> should use the appropriate collection mutation call -- you don't 
> advertise that the whole collection has changed.


My answer was: "Yes, unless there's a better way to do it."
Your answer is: "No, not if there's a better way to do it."

Unless I'm missing something, the glass is half full even when it's 
half empty.

Incidentally, in the OP's question, the dependent property was a 
collection, but advertising that the whole collection had changed was 
likely the appropriate action in *this* (slightly unusual) case.

>

>> *But* automatic dependencies do not work for properties of core 
>> data managed objects. :)
>>

> This is again at best misleading -- see <http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdFAQ.html#//apple_ref/doc/uid/TP40001802-SW3

> > for a complete discussion.

No, my statement was not misleading at all. It was wrong. Trying to 
document that there were various qualifications to the "yes", I 
misspoke on this one.

Related mailsAuthorDate
mlNSArrayController bound to @unionOfArrays not updating William Towe Apr 16, 23:48
mlRe: NSArrayController bound to @unionOfArrays not updating William Towe Apr 17, 07:54
mlRe: NSArrayController bound to @unionOfArrays not updating Quincey Morris Apr 17, 08:34
mlRe: NSArrayController bound to @unionOfArrays not updating Quincey Morris Apr 17, 18:36
mlRe: NSArrayController bound to @unionOfArrays not updating mmalc crawford Apr 17, 19:31
mlRe: NSArrayController bound to @unionOfArrays not updating Quincey Morris Apr 17, 21:29