iPhone -- Hunting Line of Code Being Executed
I am working on an iPhone project containing a ton of code. The application receives outside requests and performs actions. However, I cannot figure out exactly where the app begins executing code for a particular event. Is ther开发者_如何学Pythone some functionality in Xcode which would allow me to solve this problem?
Thank you.
Have you tried setting break points in your code? Click on the line numbers column in Xcode on the number to set a break point.
Without knowing more about what these requests are or where they are coming from, its hard to give any advice on what tools Xcode might have, but looking in any project files named <xxx>AppDelegate.m
or <xxx>Controller.m
would be a good start, placing breakpoints on likely sounding methods.
I figured out that you can use the Instruments Profiler to this end.
- Start the profiler
- Choose "Time Profiler"
- In the bottom left section make sure the following are checked: Show Obj-C only and Hide System Libraries
- In the timeline, click on the the point before the event occurred.
- Click the left-most icon in "inspection range" (located on the top-bar immediately to the left of clock)
- In the timeline, click on the point after the event completed. (optional)
- Click the right-most icon in "inspection range"
- Inspect the Call Tree.
精彩评论