FROM : Sherm Pendley
DATE : Wed Nov 24 22:20:32 2004
On Nov 24, 2004, at 4:08 PM, <email_removed> wrote:
> I have a small problem with NSInvocation, im setting an invocation up
> like this:
>
> // setWidth: is a method defined by self.
>
> NSMethodSignature* sig = [LayoutControl
> instanceMethodSignatureForSelector: @selector(setWidth:)];
> NSInvocation* incovation = [NSInvocation
> invocationWithMethodSignature:sig];
> [invocation setSelector: @selector(setWidth:)];
> [invocation setTarget:self];
>
> whenever i try and invoke it, i get this error message:
>
> 2004-11-24 16:04:04.970 Cocode[4943] *** -[NSInvocation
> copyWithZone:]: selector not recognized
>
> Whats going n here and how can i fix it?
As evidenced by the ':' at the end, setWidth: takes a parameter, but
the code above doesn't provide that parameter to the invocation.
For example, if width is a float:
float newWidth = 0.0;
[invocation setArgument:&newWidth atIndex:2];
(Indexes 0 and 1 are always target & selector, respectively.)
sherm--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
DATE : Wed Nov 24 22:20:32 2004
On Nov 24, 2004, at 4:08 PM, <email_removed> wrote:
> I have a small problem with NSInvocation, im setting an invocation up
> like this:
>
> // setWidth: is a method defined by self.
>
> NSMethodSignature* sig = [LayoutControl
> instanceMethodSignatureForSelector: @selector(setWidth:)];
> NSInvocation* incovation = [NSInvocation
> invocationWithMethodSignature:sig];
> [invocation setSelector: @selector(setWidth:)];
> [invocation setTarget:self];
>
> whenever i try and invoke it, i get this error message:
>
> 2004-11-24 16:04:04.970 Cocode[4943] *** -[NSInvocation
> copyWithZone:]: selector not recognized
>
> Whats going n here and how can i fix it?
As evidenced by the ':' at the end, setWidth: takes a parameter, but
the code above doesn't provide that parameter to the invocation.
For example, if width is a float:
float newWidth = 0.0;
[invocation setArgument:&newWidth atIndex:2];
(Indexes 0 and 1 are always target & selector, respectively.)
sherm--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
| Related mails | Author | Date |
|---|---|---|
| alex | Nov 24, 22:08 | |
| Sherm Pendley | Nov 24, 22:20 |






Cocoa mail archive

