[Solved] Re: "remote" binding problem
[Solved] Re: "remote" binding problem
- Subject: [Solved] Re: "remote" binding problem
- From: David Hirsch <email@hidden>
- Date: Tue, 06 Oct 2009 20:44:15 -0700
Okay, I'm an idiot. I did have accessors, but the getter returned
the wrong type. (An early version of the quizResults ivar was an
NSArray, and I neglected to fix the return type of the getter). Sorry
for wasting your time! Hopefully somebody will read this in the
archives and find their error in the future.
Note that I was thus incorrect: binding works through accessors,
apparently. This was not clear from the docs I had read.
-Dave
On Oct 6, 2009, at 8:21 PM, Graham Cox wrote:
On 07/10/2009, at 2:12 PM, David Hirsch wrote:
I would strongly recommend a property accessor for it instead of
relying on accessing the ivar directly.
But I can't bind through an accessor, can I? I'm supposed to be
able to bind to the ivar, I think.
You bind to properties, not to ivars. Properties are often
implemented in terms of ivars, but they are not the same thing
conceptually.
You should generally arrange that properties are accessed via
accessors. I believe that the ability to have Cocoa automatically
"find" a property that is implemented as an ivar is a convenience
too far, probably there for historic reasons. If you design classes
on the principle that this convenience doesn't exist you'll be
better off. Whether this has a bearing on your crash isn't clear
however.
Is your document's -init method being called at all? Maybe
quizResults is nil or uninitialized at the time that the
currentScore property is accessed.
--Graham
_______________________________________________
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