跟踪所有 ObjC 方法调用? [英] Track all ObjC method calls?
问题描述
有时在查看别人的大型 Objective-C 程序时,很难知道从哪里开始.
Sometimes when looking at someone else's large Objective-C program, it is hard to know where to begin.
在这种情况下,我认为记录对每个非 Apple 方法的每次调用会很有帮助.
In such situations, I think it would be helpful to log every call to every non-Apple method.
有没有办法做到这一点?基本上,在某个中心位置进行一次更改,并记录调用的每个方法.最好仅限于非 Apple 方法.
Is there a way to do that? Basically, make one change in some central place, and log every method that is called. Preferably limited to non-Apple methods.
推荐答案
您可以将环境变量 NSObjCMessageLoggingEnabled 设置为 YES.这将在文件夹/tmp/msgSends-xxx 中写入所有消息发送的日志.
You can set the environment variable NSObjCMessageLoggingEnabled to YES. This will write a log of all message sends in the folder /tmp/msgSends-xxx.
这篇关于跟踪所有 ObjC 方法调用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!