To answer your immediate question, an identifier is the string used to identify some construct (variable, type, function, whatever) in a program. For example, in the classic first C program:
#include <stdio.h>
int main(int argc, char ** argv) {
printf("Hello Cruel World!");
return 0;
}
you have the following identifiers:
main
, identifying the main functionargc
and argv
, identifying the arguments to that functionint
and char
, identifying types for those argumentsprintf
, identifying a library function
Notably, return
is not an identifier, but rather a reserved word.
In the specific example you gave, mouseDown:
is actually a method name, which is an identifier of sorts. Objective-C method names are weird because they can be split at the colons. For example, the identifier for this NSString
method:
- (instancetype)initWithCharacters:(const unichar *)characters length:(NSUInteger)length;
is initWithCharacters:length:
.
As to why you’re getting this error, it’s most likely due the context. This code:
- (void)mouseDown:(NSEvent *)event;
only makes sense within a class interface (@interface
) or a class implementation (@implementation
).
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"