• 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 recognized problem (newbie question)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: selector not recognized problem (newbie question)


  • Subject: Re: selector not recognized problem (newbie question)
  • From: Jeff Disher <email@hidden>
  • Date: Sat, 29 Mar 2003 13:54:47 -0500

In your code, you are sending that message to an instance of NSString (or rather, the NSCFString subclass).
Even though you declare that inputString is an instance of convert, you actually instantiate it as an NSString instance (note that [NSString alloc]) returns an instance of NSString, not your specific subclass. If you replace the [NSString alloc] with [convert alloc] the rest of the code should work the way that you want it to.

Hope that helps,
Jeff.


On Saturday, March 29, 2003, at 01:34 PM, Jirtme Paschoud wrote:

Hi everyone,
I'm having a problem with a very simple soft, i get no errors on compilation
but when I execute the "essai" method I get a

"-[NSCFString essai]: selector not recognized"

This would means that the object I try to pass that method don't know how to
handle it, but I hardly can't find where my mistake is.

Thanks to all for the help

Here are my two classes.

//========= main classe header=======

#import <Cocoa/Cocoa.h>
#import "convert.h"

@interface myCalc : NSObject
{

IBOutlet NSTextField *first;
IBOutlet NSTextField *input;
}
- (IBAction)compute:(id)sender;
@end

//========= main classe implementation=======

#import "myCalc.h"

@implementation myCalc

- (IBAction)compute:(id)sender
{
convert *inputString = nil;
inputString = [[NSString alloc] initWithString:[input stringValue]];
[inputString essai];
[first setStringValue: inputString];
}
@end

//========= converter classe header=======

#import <Cocoa/Cocoa.h>



@interface convert : NSString {

}

- (NSString *)essai;

@end

//========= converter classe implementation======

#import "convert.h"


@implementation convert

- (NSString *)essai
{
return @"hello";
}

@end

_____________________________________________________________________
Envie de discuter en "live" avec vos amis ? Tilicharger MSN Messenger
http://www.ifrance.com/_reloc/m la 1hre messagerie instantanie de France
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


Jeff Disher
President and Lead Developer of Spectral Class
Spectral Class: Shedding Light on Innovation
http://www.spectralclass.com/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: selector not recognized problem (newbie question)
      • From: Jérôme Paschoud <email@hidden>
References: 
 >selector not recognized problem (newbie question) (From: Jérôme Paschoud <email@hidden>)

  • Prev by Date: selector not recognized problem (newbie question)
  • Next by Date: Find-like list view?
  • Previous by thread: selector not recognized problem (newbie question)
  • Next by thread: Re: selector not recognized problem (newbie question)
  • Index(es):
    • Date
    • Thread