I seem to be able to use NSInvocation to execute methods that have
parameters are pointers, like NSString* or NSDictionary*, but when I try to
invoke a method with a parameter that is not a point, like this -

 (void)methodWithCGPoint: (CGPoint)pos;

- I get an EXC_BAD_ACCESS when I run it with code like this:

        SEL sel = @selector(methodWithCGPoint:);
        if ([self respondsToSelector: sel])
        {
            NSMethodSignature *sig = nil;
            sig = [[self class] instanceMethodSignatureForSelector:sel];
            NSInvocation *invocation = nil;
            invocation = [NSInvocation
invocationWithMethodSignature:sig];
            [invocation setTarget:self];
            [invocation setSelector:sel];
            [invocation setArgument:&pos atIndex:2];
            [invocation invoke];
         }

What is the correct way to set the CGPoint argument to NSInvocation? The
CGPoint can't get released before the invocation is finished, so [invocation
retain] doesn't help.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to