Re: [Q] Bindings, FilteringController and KVC compliance
Re: [Q] Bindings, FilteringController and KVC compliance
- Subject: Re: [Q] Bindings, FilteringController and KVC compliance
- From: Ondra Cada <email@hidden>
- Date: Fri, 17 Sep 2004 04:53:24 +0200
Peter,
On 17.9.2004, at 3:53, Peter.Teeson wrote:
On Sep 16, 2004, at 12:55, Ondra Cada wrote:
On 16.9.2004, at 18:35, Peter.Teeson wrote:
... In IB in the MyDocument.nib file there is only one connection
that I could find and that was in the File's Owner.
So I disconnected it as well. I could not find any other explicit
references to peopleController.
When built and run that way I get an exception telling me that
MyDocument is not KVC compliant for the key peopleController.
Means there is *somewhere* a binding to MyDocument.peopleController
(which is not found at runtime since you removed it).
To search for it an easy way, save the NIB in XML format, open the
result file in TextEdit and just plain search.
Interesting idea. I did that but it's not there.
Strange.
To repeat what I did with the mmalc FilteringController example (just
because I didn't understand how peopleController was used):
All right, so I've got FilteringController.
First, just after unpacking the project, I've checked where the
variable in question is used: seems it is in both the NIBs, along with
the source:
186 /tmp> find FilteringController -type f | xargs fgrep
peopleController
Binary file
FilteringController/English.lproj/MainMenu.nib/keyedobjects.nib matches
FilteringController/English.lproj/MyDocument.nib/classes.nib:
OUTLETS = {peopleController = id; };
Binary file
FilteringController/English.lproj/MyDocument.nib/keyedobjects.nib
matches
FilteringController/MyDocument.h: IBOutlet NSArrayController
*peopleController;
187 /tmp>
Checking those NIBs directly, peopleController proved
- in MainMenu.nib to be used in the bindings of those four textfields,
- in MyDocument.nib it's the File's Owner outlet, AND there are some
bindings, too.
Now, as for the usage. Seems peopleController is the "main" controller,
the one which creates and maintains the array of people. To this
controller (directly, not via the outlet) is just almost anything in
the window (the table, more precisely, its columns, the search filed,
the text field bottom right) bound.
(0) In MyDocument.h I commented out the only reference to
peopleController in the project source code.
(1) In IB I read the MyDocument.h file and did a replace in the Parse
and saved the nib.
Which means you've broken the way the MainDocument.nib's textfields are
bound: if you check it out, you'll see they are bound to
mainWindow.delegate.peopleController.selection.XYZ
where XYZ is the appropriate attribute. That's the culprit:
mainWindow.delegate gets you the MyDocument instance, whose attribute
"peopleController" does not exist anymore, for you have removed it.
That's why you get the exception:
(2) Back in Xcode I re-built the target and ran it getting this
exception:
2004-09-16 21:31:42.775 FilteringController[10530] [<MyDocument
0x351ec0> valueForUndefinedKey:]:
this class is not key value coding-compliant for the key
peopleController.
...
So my original question remains:
Why and how does the exception arise if there are no bindings and no
source code reference to peopleController?
There *are* bindings, from MainMenu.nib, as shown above. That's the
reason the exception is risen.
I am suspicious that there may be an undocumented thing going on here
but don't have a clue where to look for this.
There are undocumented things going on here all right, but not at this
comparatively easy level :)
Does MMALC care to comment (please)?
I guess he keeps his temper tightly under control, not daring to say
what he would like to :)))))
---
Ondra Čada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden