• 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
Re: Selector not working for me
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Selector not working for me


  • Subject: Re: Selector not working for me
  • From: Dan Bernstein <email@hidden>
  • Date: Mon, 2 May 2005 11:27:18 +0200

To get YES, you should either send -respondsToSelector: to an object of class Seltest or -instancesRespondToSelector: to the class itself (currently you're querying the class for a class method +test1:). Another mistake is that you're querying about test1: (with a colon), while you actually implement test1 (without a colon).

On 5/1/05, John James <email@hidden> wrote:
I am probably doing some stupid newbie thing; please help.

i have a simple test case to try the selector feature. given the following  class definition and implementation:
--------------
#import <Cocoa/Cocoa.h>

@interface Seltest : NSObject  
{}
    -( void)test1;
    -(void )test2:(NSString*)val;
@end

-----------
#import "seltest.h"

@implementation Seltest

-(void)test1
{NSLog(@"test1" );}

-(void)test2:(NSString*)val
{NSLog(val);}

@end
-------------------

Elsewhere At runtime I try the following

    if ([Seltest respondsToSelector: @selector(test1:)]== YES)
        NSLog(@"YES" );
    else
        NSLog( @"NO");

I always get NO!
Shouldn't it be YES?
Thanks for your help

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (


 _______________________________________________
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

References: 
 >Selector not working for me (From: John James <email@hidden>)

  • Prev by Date: Fwd: NSBezierPath and line intersection
  • Next by Date: Re: Tiger gcc 4 builds apps that don't run on 10.2.8
  • Previous by thread: Re: Selector not working for me
  • Next by thread: Re: Selector not working for me
  • Index(es):
    • Date
    • Thread