开发者

Xcode find caller functions

开发者 https://www.devze.com 2022-12-16 11:58 出处:网络
In Xcode, how can I find all caller f开发者_Python百科unctions of a specific function?Xcode 4.5 (in beta) has this functionality. when you highlight say... a function, you can check the \"caller\" and

In Xcode, how can I find all caller f开发者_Python百科unctions of a specific function?


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)

Xcode find caller functions

:

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];


In Xcode, 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 -> Editor -> Show Related Items in Xcode's menu.


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


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.

Xcode find caller functions


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


Xcode 10 upwards seems to have made it easier. Just Command Click on the function and you should see it in the drop down.

Xcode find caller functions


Press ⌘+Ctrl+Shift+H shortcut when a method of interests is selected (with a mouse or cursor). (as per @uiroshan 's answer)

But you can also specify any another shortcut in XCode -> Preferences -> Key Bindings

Xcode find caller functions


Use Find in Project as Text or as Symbol.

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


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号