setValue:forKey: and invocation forwarding
setValue:forKey: and invocation forwarding
- Subject: setValue:forKey: and invocation forwarding
- From: Graham Cox <email@hidden>
- Date: Tue, 13 Jul 2010 22:53:59 +1000
It appears that calling -setValue:forKey: on an object bypasses or ignores any invocation forwarding it has set up, unless I'm missing some obvious error.
I have an object that acts as a wrapper for another object, and so that the wrapper can, under some circumstances, act as the thing it is wrapping, it implements invocation forwarding using the 'classic' approach of overriding -respondsToSelector:, -methodSignatureForSelector: and -forwardInvocation: but when I call -setValue:forKey: on the wrapper (where key is implemented by the thing wrapped), it throws the 'not key-value coding compliant for key' exception. The stack trace appears to show that this failure occurs before it has even attempted to follow the forwarded path. However if I simply call the wrapped property setter directly, the forwarding works. As this needs to work on 10.5, I can't use the 10.6 solution of -forwardingTargetForSelector: (not that I've tested it to see if it exhibits the same issue or not).
Is this the expected behaviour?
--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