Join the Stack Overflow Community
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

In Xcode, how can I find all caller functions of a specific function?

share|improve this question
2  
By the way, i've attached an image to my answer. and XCode versions nowadays support this. would you be willing to upvote/accept an answer, if you are satisfied with any of the answers?? – David T. Nov 20 '12 at 15:57

Xcode 4.5 (in beta) has this functionality. when you highlight say... a function, you can check the "caller" and "callee"

edit i believe it's located at the top left of the file panel for that file... so double click on the function to highlight it, and you click on on the file panel options (the one that has the "open recent, open unsaved...etc" drop down

EDIT #2

here's a picture to clarify (since i dont know what this menu button is called)enter image description here:

ALSO - XCode 4.5 is no longer beta, i believe, and is actually out in public

EDIT #3

also note that this caller thing does NOT search for being called under the performSelector method, as in, the particular caller that has this performSelector won't show up if you had done something like:

[self performSelector:@selector(checkIfShouldStopMovement) withObject:nil afterDelay:0.25];
share|improve this answer
5  
It's actually View->Standard Editor->Show Related Items, see my answer (stackoverflow.com/a/13472334/888091). – pille Nov 20 '12 at 11:38
2  
@pille Ah. I see, i didn't know you can access it that way. I've upvoted your answer, and i've edited my answer to show the UI way. Thanks for the shortcut!! – David T. Nov 20 '12 at 15:56

In XCode 4.5, the quickest method is this:

  1. Select method in code (double click or mark using your mouse cursor)
  2. Press Ctrl+1
  3. Select "Callers" from the pop-up menu.

This is the shortcut for going View->Standard Editor->Show Related Items in XCode's title menu.

share|improve this answer
1  
The Callers menu is also context sensitive, so you don't have to select the method first. Just place it anywhere within the method that you want to see the callers for before invoking the <kbd>Ctrl</kbd>+<kbd>1</kbd> shortcut. – Jay Feb 21 '13 at 17:51
    
Sweet, didn't know that! – pille Feb 23 '13 at 20:26
1  
I can't believe there isn't faster way... I am quite disappointed with the Xcode after using IntelliJ – stevo.mit Jun 15 '15 at 14:26

This can also be accessed via the assistant editor, as shown in the screenshot below. Whichever method you have the insertion point in in the main editor on the left will have its callers displayed in the assistant editor. I've found this to be the best way of looking through each caller in succession, since once you have "Callers" selected, you can then select the next caller via the next pop-up menu to the right in the jump bar.

enter image description here

share|improve this answer
    
This is great -- but it took me a while to figure out how to get started. For others following me: notice that in Brian's screenshot, the open drop-down is not the "Show Related Items" (ctrl+1) menu mentioned in some other answers. Instead, in the assistant editor, click on the drop-down to the right of the "Go Forward" button, and choose Callers. – Ashley Jun 18 '13 at 16:22
    
You don't need to use the assistant editor. You can open the same menu in the primary editor. – funroll Aug 28 '14 at 16:59

In Xcode-7 you have the functionality of getting call-heirerchy. Right-click on the function and click "Find Call Hierarchy": image reference:

share|improve this answer
4  
it's called "Call Hierarchy" and the keyboard shortcut is: CTRL-SHIFT-COMMAND-H (while something is selected). – Wizfinger Jan 17 at 10:23

use ⌘+Ctrl+Shift+H key combination on XCode 7 onwards.

share|improve this answer
1  
more like Xcode shortcut to RSI – Vlad Apr 29 at 1:25

Use Find in Project as Text or as Symbol.

AFAIK, there's no equivalent to e.g. Call Hierarchy known from Eclipse or NetBeans.

share|improve this answer
1  
There are "caller" and "callee" in xCode. – user1494994 Aug 6 '14 at 16:38

Strangely the refactoring tool can detect all method calls but not the search.

So I simply use it to rename my method to a unique name (eg. reset to resetPlayer) and then use the new name in a regular textual search.

1.) Menu > Edit > Refactor... > Rename to unique name

2.) search for the new name

share|improve this answer
    
You can also just review all the places that would be modified in the preview, without actually finishing the refactor operation. – funroll Jun 4 '13 at 15:55

The functionality is available in XCode 4.4.1, see this: http://smilingfinney.blogspot.de/2012/09/method-callers-in-xcode-44.html

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.