osx - Core Data: "-add<RelationshipKey>Object:" not called -


let's presume have entity bikerider relationship property called helmets.

i have array controller bound app's managed object context, entity set bikerider. there's tableview lists bike riders.

then, have second array controller, bound app's managed object context, entity set helmet. additionally, it's bound bikeriderarraycontroller.selection. there's second tableview lists helmets selected bike rider.

i have 2 buttons adding , removing helmets. setup works apparently flawlessly.

except, of course 1 small thing: looks -addhelmetsobject:, -removehelmetsobject:, -addhelmets: , -removehelmets: never called. means code setting observation of each helmet's color property never gets called.

what missing? isn't overriding addhelmets: et al (with proper willchangevalueforkey: et al notifications) right way notified of additions?

do have to [self observevalueforkey:@"helmets". . .] , [oldvalue minusset:newvalue] , vice versa figure out objects added or removed? swear methods being correctly called in past. maybe key element of setup different.

this has never worked through nsarraycontroller. apple's docs:

custom relationship set mutator methods not invoked arraycontroller

problem: have implemented set mutator methods relationship described in “custom to-many relationship accessor methods,” , have bound contentset binding of nsarraycontroller instance relationship, set mutator methods not invoked when add objects , remove objects array controller.

cause: bug.

remedy: can work around adding self contentset binding's key path. example, instead of binding [department object controller].selection.employees, bind [department object controller].selection.self.employees.


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -