当我在iPhone模拟器中运行我的应用程序时,如何查看调用的每个方法? [英] How do I see every method called when I run my application in the iPhone Simulator?

查看:70
本文介绍了当我在iPhone模拟器中运行我的应用程序时,如何查看调用的每个方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的很想看到每个方法,委托,通知等等,当我在iPhone模拟器中运行我的应用程序时调用/发送。我认为正确的地方是调试器,但我找不到合适的设置。

I would really like to see every method, delegate, notification, etc. which is called / sent while I run my app in the iPhone Simulator. I thought the right place for this would be in the debugger, but I can't find the right setting.

我的目标是看到后台发生的所有事情,例如,我在UITableView中添加一行或从我的UINavigationController中按下后退按钮。

My target is to see all that is happening in the background while I, for example, add a row to a UITableView or push the 'back'-button from my UINavigationController.

这对于确定当应用程序中的某些内容发生时或用户按下按钮,更改视图等时要使用的委托是一个很大的帮助。

This would be a big help to figure out what delegate to use when something in the app is happening or when the user is pushing a button, changing a view, etc.

是否有可能获得此信息?

Is it possible to get this information?

推荐答案

你可以使用DTrace注销应用程序运行时发生的所有事情,DTrace是一个框架,可以让您探索在现代Mac上运行的任何内容的内部工作。我们在iOS上还没有DTrace,但是当你在模拟器中运行时它会工作。

You can log out everything that is happening when your application is running using DTrace, a framework that lets you probe the inner workings of anything running on a modern Mac. We don't yet have DTrace on iOS, but it will work while you're running within the Simulator.

我在这篇文章 for MacResearch,然后在这篇文章。该应用程序从应用程序启动到注销 -applicationDidFinishLaunching:结束时,会记录所有对象(甚至是内部系统对象)上调用的所有方法。

I describe the fundamentals of DTrace in this article for MacResearch, then provide an example of a custom instrument you can build in Instruments using DTrace near the end of this article. That instrument logs out all methods called on all objects (even internal system ones) from the moment your application starts until it hits the end of -applicationDidFinishLaunching:.

为简化此操作,您只需使用工具|创建自定义乐器。在仪器中构建新仪器菜单项。将其中一个探测描述符设置为如下所示:

To simplify this, you can simply create a custom instrument using the Instrument | Build New Instrument menu item in instruments. Set up one of the probe descriptors to look like the following:

仅忽略 isInApplicationStart 和时间戳记录选项。响应任何类中的任何Objective-C方法的简单探测器会将所有这些消息记录到Instruments控制台,这听起来就像您想要调试的那样。

only ignore the isInApplicationStart and timestamp logging options. A simple probe responding to any Objective-C method in any class will log all of those messages to the Instruments console, which sounds like what you want for your debugging.

这篇关于当我在iPhone模拟器中运行我的应用程序时,如何查看调用的每个方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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