Re: NSPredicate / NSArray addObserver:forKeyPath:options:context: exception
Re: NSPredicate / NSArray addObserver:forKeyPath:options:context: exception
- Subject: Re: NSPredicate / NSArray addObserver:forKeyPath:options:context: exception
- From: Keary Suska <email@hidden>
- Date: Sat, 29 Sep 2012 07:59:10 -0600
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...
HTH,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
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