• 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: +[NSConstantString length]: selector not recognized
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: +[NSConstantString length]: selector not recognized


  • Subject: RE: +[NSConstantString length]: selector not recognized
  • From: "Jonathan E. Jackel" <email@hidden>
  • Date: Fri, 14 Mar 2003 12:15:11 -0500

> > NSArray *nothing = [self create:createArg array:picks];
>> > And up until this point everything seems ok. createArg contains
> > something like "[Right] :Things" -- no apparent problems.
> > The beginning of create:array: looks like this:
> > - (NSArray *)create:(NSString *)arguments array:(NSArray *)picks
> > {
> > NSArray *args = [arguments componentsSeparatedByString:@":"];
>
>
> Break in the debugger and se what arguments is. Do you have an
> arguments instance variable that perhaps it is using instead and is
> uninitialized?

The arguments string appears to be a valid string in the debugger. There is
no instance variable called arguments.


> Is self a pointer to an instance of your class, or your
> class itself?

An instance. -create:array is an instance method. Should not be a problem.


> If the first code you have above is a class method,
> than self here would be the class and not the instance, and arguments
> would also be a class not an instance, and you would probably throw an
> exception for selector not recognized.

No, we're dealing with an instance of the class all the way.


>
> > And this is where the fun starts. As soon as I hit this statement, I
> > get:
> >
> > 2003-03-13 21:10:33.004 DGStitcher[1187] *** +[NSConstantString
> > length]: selector not recognized
> >
> It threw an exception, and since you weren't catching them it goes up
> to the default handler which prints this.

Yes. I have a breakpoint set on -[NSException raise].

>
> Instances of NSConstantString should respond to length
> The Class of NSConstantString does not.
>
> The +[NSConstantString means that the length method is being sent to
> the class and not to an instance.
>

Yes, I realize that the + indicates a class method. But I am sending no
such messages. I am sending a -componentsSeparatedByString message to what
appears to be a valid NSString instance. But it throws an exception for no
reason that is apparent to me. I don't see
hy -componentsSeparatedByString would send a length message to a class.

Jonathan
_______________________________________________
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: +[NSConstantString length]: selector not recognized
      • From: "Jonathan E. Jackel" <email@hidden>
References: 
 >Re: +[NSConstantString length]: selector not recognized (From: Karl Kraft <email@hidden>)

  • Prev by Date: Re: anoncvs.opensource.apple.com CVS server dead?
  • Next by Date: Re: anoncvs.opensource.apple.com CVS server dead?
  • Previous by thread: Re: +[NSConstantString length]: selector not recognized
  • Next by thread: RE: +[NSConstantString length]: selector not recognized
  • Index(es):
    • Date
    • Thread