我如何确定“呼叫者"身份?我在Objective-C中的方法? [英] How can I determine the "caller" of my method in Objective-C?

查看:69
本文介绍了我如何确定“呼叫者"身份?我在Objective-C中的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一个相当复杂的应用程序,我也许天真地同意调试".进入某种方法后,我想打印出有关谁调用该方法,从哪个类,方法等中调用它的尽可能多的信息.任何建议将不胜感激!

So I have a rather complex application that I've, perhaps naively, agreed to "debug". Upon entering into a certain method, I'd like to print out as much info about who called the method, from which class, method, etc. it was called from. Any suggestions would be very much appreciated!!

推荐答案

只需添加您的方法:

NSLog(@"Show stack trace: %@", [NSThread callStackSymbols]);

这篇关于我如何确定“呼叫者"身份?我在Objective-C中的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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