• 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
Why would a defined selector not be found at runtime?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why would a defined selector not be found at runtime?


  • Subject: Why would a defined selector not be found at runtime?
  • From: Ken Tozier <email@hidden>
  • Date: Thu, 12 May 2005 05:46:41 -0400

This is most likely a stupid error on my part, but I'm getting a
"selector not recognized" error for a method that is definitely
defined in my NSButtonCell subclass.

The interface is defined like this:

#import <Cocoa/Cocoa.h>

@interface NSDisclosureButtonCell : NSButtonCell
{
     NSBezierPath    *collapsedBezel;
     NSBezierPath    *expandedBezel;
}

- (id) initWithControlSize:(NSControlSize) inSize;

@end



The implementation of the problematic method is defined like this:

#import "NSDisclosureButtonCell.h"

- (id) initWithControlSize:(NSControlSize) inSize
{
     self = [super init];
     if (self == nil)
     return nil;

     [self setControlSize: inSize];
     [self initCollapsedBezel];
     [self initExpandedBezel];

    return self;
}



A factory method in a separate "UIControls" class is defined like this:

@class NSDisclosureButtonCell;

@interface UIControls: NSObject

+ (NSDisclosureButtonCell *) plainDisclosureBezelInView:(NSView *)
inView
                         origin:(NSPoint) inOrigin
                         size:(NSControlSize) inControlSize;

@end



And it's being called from the factory method like this:

#import "NSDisclosureButtonCell.h"

@implementation UIControls

+ (NSDisclosureButtonCell *) plainDisclosureBezelInView:(NSView *)
inView
           origin:(NSPoint) inOrigin
           size:(NSControlSize) inControlSize
{
     NSDisclosureButtonCell    *result        =
[NSDisclosureButtonCell alloc];

     // always chokes on the next line at runtime
     [result  initWithControlSize: inControlSize];

     [result setState: NSOffState];

     return [result autorelease];
}

@end


As is clear from above, everything seems to be defined correctly and the necessary "#import" directives are present, so why am I getting "*** -[NSDisclosureButtonCell initWithControlSize:]: selector not recognized" at runtime?

I put NSLogs in the "plainDisclosureBezelInView" method and they show
that the allocation executes OK, the "inControlSize" contains a valid
value but when it gets to the "initWithControlSize" method I always
get the "selector not recognized" error. Anyone see the problem?

Thanks

Ken

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Why would a defined selector not be found at runtime?
      • From: Ricky Sharp <email@hidden>
  • Prev by Date: 10.3.9 SDK generates error
  • Next by Date: Re: I want NSTextView to grow horizontally as text is entered
  • Previous by thread: Re: 10.3.9 SDK generates error
  • Next by thread: Re: Why would a defined selector not be found at runtime?
  • Index(es):
    • Date
    • Thread