跟踪所有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屋!