forwardInvocation: Works Locally but crashes with DO
forwardInvocation: Works Locally but crashes with DO
- Subject: forwardInvocation: Works Locally but crashes with DO
- From: Joe Lester <email@hidden>
- Date: Wed, 7 Aug 2002 09:54:27 -0500
My app (let's call it App1) is using a lightweight object to forward
unrecognized messages to its "surrogate" object. I do this by overriding
"forwardInvocation :" and "methodSignatureForSelector:". It works great
locally but when I try to access this object from my other app (App2)
using a remote proxy, App1 crashes with a signal 10.
If I remove "forwardInvocation :" and "methodSignatureForSelector:" from
my lightweight object and add direct accessor methods instead everything
works great... no crashes when App2 tries to connect to App1.
What gives? I would like to use message forwarding since it is much more
elegant that having to clutter up a lightweight class with all those
darn accessor methods. Any ideas? Here are the two methods that I had to
remove (but I would like to get working):
id surrogateObj;
- (void)forwardInvocation:(NSInvocation *)invocation
{
if ([surrogateObj respondsToSelector:[invocation selector]])
{
[invocation invokeWithTarget: surrogateObj];
}
else
{
[self doesNotRecognizeSelector:[invocation selector]];
}
}
- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
{
if ([self respondsToSelector:aSelector])
{
return [self methodSignatureForSelector:aSelector];
}
else
{
return [surrogateObj methodSignatureForSelector:aSelector];
}
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.