On 29/09/2012, at 15.59, Keary Suska <cocoa-...@esoteritech.com> wrote:
> On Sep 28, 2012, at 7:17 PM, Mikkel Eide Eriksen wrote:
> On 28/09/2012, at 03.51, Keary Suska wrote:
>>> On Sep 27, 2012, at 11:54 AM, Mikkel Eide Eriksen wrote:
>>>> 
>>>> When I run my app, I get an exception (quoted below) as soon as I expose 
>>>> my objects to my array controller (via a property on my document it's 
>>>> bound to), though as far as I can tell, the predicate should be 
>>>> functionally the exact same? For completness, inspecting it in the 
>>>> debugger yields:
>>> 
>>> I suspect that somewhere in your xib you are binding through the array, 
>>> which you can't do. Look for a binding key path that begins with or 
>>> contains "personalNames" and that has a key after it (such as 
>>> "personalNames.value").
>> 
>> The keypath:
>> 
>> ANY personalNames.value.gedcomString CONTAINS "..."
>> 
>> is composed of the following keys:
>> 
>> GCIndividualEntity has a KVC-compliant collection property called 
>> _personalNames_ which is an array of GCPersonalNameAttributes which each 
>> have a GCValue property called _value_ which again have an NSString property 
>> _gedcomString_ (by the way these are NSObjects, not Core Data).
>> 
>> I am not binding to the keypath in my xib, but obtain the predicate via 
>> code. The array controller is bound to a property "individuals" on File's 
>> Owner (my NSDocument subclass).
>> 
>> When I've loaded the file, I set self.individuals = 
>> self.context.individuals, causing a table view bound to the array controller 
>> to show the objects; this works as expected, as well as a detail-view 
>> connected to the controller's selection. I then attempt to set the array 
>> controller's predicate and immediately it dies with the mentioned exception.
> 
> To backtrack sightly, the specific exception you are getting is being thrown 
> by an NSArray because some other object is calling addObserver:forKeyPath: on 
> it. In the debugger you can verify which array it is, and you should also be 
> able to narrow down which object is calling addObserver:forKeyPath:, or at 
> least for whom it is being called. I can't recommend further until we know 
> what those are...

As far as I can tell it's the array controller doing the observing (I set a 
symbolic breakpoint on NSArray addObserver):

#0      0x00007fff955c046b in -[NSArray(NSKeyValueObserverRegistration) 
addObserver:forKeyPath:options:context:] ()
#1      0x00007fff955204ae in -[NSKeyValueNestedProperty 
object:didAddObservance:recurse:] ()
#2      0x00007fff955191b9 in -[NSObject(NSKeyValueObserverRegistration) 
_addObserver:forProperty:options:context:] ()
#3      0x00007fff9551812d in -[NSObject(NSKeyValueObserverRegistration) 
addObserver:forKeyPath:options:context:] ()
#4      0x00007fff98074799 in -[_NSModelObservingTracker 
_registerOrUnregister:observerNotificationsForKeyPath:] ()
#5      0x00007fff97e96e11 in -[_NSModelObservingTracker 
registerModelKeyPaths:unregisterModelKeyPaths:] ()
#6      0x00007fff9805b484 in -[NSArrayController 
_updateAutomaticRearrangementKeysPaths] ()
#7      0x00007fff9811d8ba in -[NSArrayController 
_didChangeArrangementCriteriaWithOperationsMask:useBasis:] ()
#8      0x00007fff97e9f72c in -[NSArrayController setFilterPredicate:] ()

Mikkel
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to