Re: double forwarding problem
Re: double forwarding problem
- Subject: Re: double forwarding problem
- From: Ivan Kourtev <email@hidden>
- Date: Sat, 4 Nov 2006 14:03:34 -0500
On Nov 4, 2006, at 12:18 PM, Jakob Olesen wrote:
On 04/11/2006, at 1.07, Ivan Kourtev wrote:
The problem is that methodSignatureForSelector is sent before
forwardInvocation so I don't have a chance to simply change the
invocation target. At this point, the only thing that comes to
mind is to change the implementation of - [B
methodSignatureForSelector] to check whether B responds to the
selector (as in the example at the end). But then what do I
return if I find out that respondsToSelector is YES? I can't
return [self methodSignatureForselector:selector] because it will
start calling itself recursively.
This is the right thing to do, and you can call [super
methodSignatureForselector:selector] to get the original (NSObject)
implementation.
Of course! This worked.
Is this kind of double forwarding a bad idea in principle or am I
missing some [hopefully more elegant] way to resolve this?
It is a quite complicated thing to do, but certainly possible. You
don't say which problem you are trying to solve, so it is difficult
to give you advise about better solutions.
I didn't really intend for this situation to occur. What is
happening is I have a controller (fooA, please see original post) and
a model (fooB). There are quite a few messages that the controller
forwards straight to the model.
On the other hand the model is an interface for a complex embedded
data structure (fooC) and it just happens that the model forwards a
set of messages directly to the data structure.
That's what got me into the double forwarding mess. Does the above
sound like the wrong thing to do (conceptually, I mean, is it a poor
design)?
-- ivan
_______________________________________________
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