在iPhone应用程序中跟踪方法调用 [英] Tracing the method calls in iPhone app

查看:44
本文介绍了在iPhone应用程序中跟踪方法调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在运行iPhone应用程序时,如何跟踪方法调用及其顺序?我应该使用哪种乐器?

How can I trace the method calls and their sequence while a iPhone app is running? Which Instrument I should use?

推荐答案

没有仪器直接执行此操作.获得此类信息的几种选择:

No Instrument does this directly. A couple of options to get this kind of information:

1)在调试器中设置一个断点.然后,您可以使用逐步跳过",逐步进入"和逐步退出"按钮来跟踪执行情况.

1) Set a breakpoint in the debugger. You can then trace the execution with the "step over" "step into" and "step out" buttons.

2)将NSLogs放在代码中您感兴趣的位置:

2) Put NSLogs at the places in your code that interest you:

-(void) someMethod {
  NSLog (@"Starting someMethod");
  // rest of the method is here
}

然后您可以在控制台中读取NSLog.

You can then read the NSLogs in the console.

这篇关于在iPhone应用程序中跟踪方法调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆