Re: NSProxy/NSInvocation question
Re: NSProxy/NSInvocation question
- Subject: Re: NSProxy/NSInvocation question
- From: Paul Forgey <email@hidden>
- Date: Mon, 28 Jun 2010 16:56:47 -0700
I answered my own question. The documentation for [NSMethodSignature signatureWithObjTypes:] is wrong. The first element in the type array is the return typed, not the id or Class type, which in effect left me with an MSMethodSignature instance containing no argument type for the selector parameter. In this case, the method took no arguments, so the method signature was saying it returned an instance, took a selector as the instance type and had no selector.
On Jun 28, 2010, at 3:20 PM, Paul Forgey wrote:
> I am writing an NSProxy subclass to generically marshal and forward invocations. I have read previous mailing list posts on this topic.
>
> For reasons I cannot explain and shouldn't be happening according to my interpretation of the documentation, [NSInvocation selector] is throwing an NSInvalidArgumentException:
>
> - (void)forwardInvocation:(NSInvocation *)invocation
> {
> NSString *selName = NSStringFromSelectorName([invocation selector]);
>
> at this point:
>
> 2010-06-28 15:12:39.694 Monotest[23948:a0f] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSInvocation getArgument:atIndex:]: index (1) out of bounds [-1, 0]'
> *** Call stack at first throw:
> (
> 0 CoreFoundation 0x95351bba __raiseError + 410
> 1 libobjc.A.dylib 0x98f26509 objc_exception_throw + 56
> 2 CoreFoundation 0x952f7c31 -[NSInvocation getArgument:atIndex:] + 225
> 3 CoreFoundation 0x952f8958 -[NSInvocation selector] + 56
>
> even an empty NSInvocation shouldn't be doing that; at the very least, selector is supposed to return 0 if there is no selector set.
>
>
_______________________________________________
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