In objective-c how can I make a misnamed selector generate a compile time error?
For example, say I have this
@selector(some_misnamed_func)
And my class has this member
-(void)some_func
I want the objective-c compiler to tell me that it can’t find that function at compile time rather than generate a run-time exception only when that code is run.
Compile your code with
-Wundeclared-selector, or Undeclared selector in Xcode’s build settings. Since that’s a warning only, you can couple it with-Werror(resp. Treat Warnings as Errors in Xcode) to make that warning (and all other warnings) behave as an error and effectively abort the compilation.