开发者

iOS trace in XCode 4?

I'm working on an iOS project and am trying to find out how I can go about getting a trace of all the functions that are being called when I do something on my emulator.

The reason I'm looking for something like this is because I'm not quite sure what listeners are being triggered upon some of my actions on 开发者_如何转开发the emulator.

Cheers and thanks again.


Set a breakpoint?

I'd read Apple's guide to debugging first, but just click the sidebar to the left of the line of code you want to stop at, and a blue indicator will appear. Then when you run the app, it will break when that line of code is hit. From there you can look at the stack using the acessory view on the bottom (where NSLog outputs, there are two views... one has the stack trace).


When your debugging a large code base with multiple listeners, it's sometimes tough to figure out where to put the right break point. Another option is to log to see all the listeners that are triggered.

However, a big issue with NSLog is you'll end up littering your code and then eventually want to remove it before shipping.

Ideally, you could:

  1. Add logging/tracing throughout your code
  2. Enable/Disable the logging at levels
  3. Optionally turn it off for retail shipping.

I have logging macros which offers those which I pieced together from others and I responded to this SO article and pasted in the implementation.

What logging solutions to use while log-debugging objective-C code?

Hope that helps

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜