Re: Simple Newbie Question on Calling a Method
Re: Simple Newbie Question on Calling a Method
- Subject: Re: Simple Newbie Question on Calling a Method
- From: Sailor Quasar <email@hidden>
- Date: Sat, 20 Dec 2003 16:05:52 -0500
On Saturday, December 20, 2003, at 03:17 PM, Jerry Krinock wrote:
I've been trying to bring window to the front for a couple hours now,
even
looking in books. Probably my whole conception of the way methods are
called in Objective-C is wrong.
[snip]
in another .mm file, I call my function with the message:
[Controller bringSorterWindowToFront] ;
Result: It compiles OK, but upon running, I get:
2003-12-20 08:27:43.183 JerrysSorter[11866] *** +[Controller
bringSorterWindowToFront]: selector not recognized
2003-12-20 08:27:43.184 JerrysSorter[11866] *** Uncaught exception:
<NSInvalidArgumentException> *** +[Controller
bringSorterWindowToFront]:
selector not recognized.
Thanks for an answer to this!
The key thing to notice in the exception you're getting is the + in the
"selector not recognized" message. This is not telling you that your
Controller object doesn't recognize the method. This is telling you
that the Controller _class_ doesn't recognize the method. You've called
the method as "[Controller bringSorterWindowToFront]", which says "look
for a method of the class Controller", not "look for a method of an
object of type Controller". If you're familiar with C++, you're calling
the method as a static class method rather than an object method. You
probably meant [someObjectOfTypeController bringSorterWindowToFront].
Where you get someObjectOfTypeController depends on where you're trying
to call the method from.
-- Sailor Quasar, guardian of Leraz's memory
"A face of stone may hide a soul with the deepest Love of all"
Email: email@hidden
_______________________________________________
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.