NSInvocation problem - "NSView not correctly initialized"
NSInvocation problem - "NSView not correctly initialized"
- Subject: NSInvocation problem - "NSView not correctly initialized"
- From: Robert Nikander <email@hidden>
- Date: Sun, 4 Nov 2007 23:07:00 -0500
Hi all,
The following test program demonstrates a problem I'm having: when I
call [NSButton alloc] through an NSInvocation, I get this error message:
2007-11-04 22:55:22.631 buttons[8483] NSButton(0x314150) - NSView not
correctly initialized. Did you forget to call super?
Strangely, the button seems to function fine, despite the message.
Is there something wrong with the way I'm using NSInvocation?
thanks,
Rob
#import <Cocoa/Cocoa.h>
int main()
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSApplication *app = [NSApplication sharedApplication];
id b;
SEL alloc_sel = @selector(alloc);
id button_class = NSClassFromString(@"NSButton");
printf("Allocate button normally...\n");
b = [NSButton alloc];
printf(" done\n\n");
printf("Try objc_msgSend...\n");
b = objc_msgSend(button_class, alloc_sel);
printf(" done\n\n");
printf("Try with NSInvocation...\n");
id sig = [button_class methodSignatureForSelector: alloc_sel];
id inv = [NSInvocation invocationWithMethodSignature: sig];
[inv setSelector: alloc_sel];
[inv setTarget: button_class];
[inv invoke];
[inv getReturnValue: &b];
printf(" done\n\n");
[pool release];
}
_______________________________________________
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