• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSInvocation problem - "NSView not correctly initialized"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: NSInvocation problem - "NSView not correctly initialized"
      • From: "Clark Cox" <email@hidden>
  • Prev by Date: Re: Locating managed objects within ObjectAlloc (was Re: Garbage collection, core data, and tight loops)
  • Next by Date: Re: I'm losing my memory (GC & NSImageView)
  • Previous by thread: Re: Converting *u unicode hex sequences
  • Next by thread: Re: NSInvocation problem - "NSView not correctly initialized"
  • Index(es):
    • Date
    • Thread