"Jump to Definition" not working consistently with target/action pattern

I've inherited a large project. Digging around the codebase has been tough because "Jump To Definition" isn't working consistently.

The codebase is almost entirely in Objective-C, and I'm seeing usage of the target-action pattern like:

Code Block
// ViewController1.m
- (void)viewDidLoad {
[super viewDidLoad];
UIButton *button = [UIButton new];
[button addTarget: self action:@selector(selected) forControlEvents: UIControlEventTouchUpInside];
}
- (void)selected {
NSLog(@"selected in View Controller 1");
}


When I command + control + click on the "selected" method name inside of the @selector attribute, it will jump to the definition of the wrong method. The incorrect method has the same signature: it is named "selected" and takes no arguments. But that implementation is in an unrelated class in a different source file.

My first instinct was that this is a bug when using @selector, but I was not able to duplicate in a simple sample project - two source files that have a selector with the same name will behave as expected when trying to Jump to Definition. I thus believe this to be an issue due to the nature of the inherited project - it's very large, and there are over 200 existing warnings. It takes a very long time to index. I wonder if that has anything to do with it?

Are there any tips for dealing with "Jump to Definition" not working in a legacy project? I plan on fixing the warnings at some point, but if there's another thing I can do in the meantime it would be helpful as I familiarize myself with the code.

UIButton addTarget, click selector can not jump the method define line

"Jump to Definition" not working consistently with target/action pattern
 
 
Q