Objective-c – What’s wrong with this selector declaration

cocoa-touchiphoneobjective c

I expect this to work based on the docs here: http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/ObjectiveC/Articles/ocSelectors.html

SEL sel = @selector(loadMapType:[ms uniqueTilecacheKey]);

"error: expected ')' before '[' token"

Best Answer

[ms uniqueTilecacheKey]

That's what's wrong. A selector is essentially just a method signature, so you don't pass it parameters.

It should instead look like

SEL sel = @selector(loadMapType:);