If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
Do I have to create an instance before I can call a class method in Cocoa? I imported the class and am trying to call a method from it but I keep getting a "'query' undeclared (first use in this function)" error. query is the name of the class.
Nope. There are lots of cases where you call class methods without having instances around (usually to get instances, like <font face = "courier">[NSWorkspace sharedWorkspace]</font> or <font face = "courier">[NSString stringWithContentsOfFile:]</font>).
You're probably running into a different problem. My guesses:
Has the class been properly declared in whatever header file you're importing?
Class names are case sensitive, and generally begin with an uppercase letter. Are you referring to the class by the correct name?
Is the class from a framework or library, in which case you need to make sure said framwork/library is properly linked into your project?
Thanks, Rick. I worked my way through the problem. As you suggested I had an error in the class declaration that was a bit difficult to find. Once I located and fixed it, everything is working fine.