打印当前堆栈跟踪的应用程序的简单方法? [英] Easy way to print current stack trace of an app?

查看:116
本文介绍了打印当前堆栈跟踪的应用程序的简单方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Xcode / objective c并不真正打印一个有用的堆栈跟踪。我的应用程序崩溃的地方,这个死的东西给了我只有数字45353453,34524323,6745345353,457634524234.根本没有用。

Xcode / objective c does not really print a useful stack trace. My app crashes somewhere, and the damn thing gives me only numbers like 45353453, 34524323, 6745345353, 457634524234. Not useful at all.

所以我想使一个NSLog );在开始的每个方法我在我的整个应用程序。但也许有一个更简单的方法来找出真正的堆栈跟踪,人类可读?不仅是应用程序启动或崩溃,但所有的时间,发生的每一个活动?

So I want to make a NSLog(); on the beginning of EVERY method I have in my entire app. But maybe there's a simpler way to just find out the real stack trace, humanly readable? Not only on app launch or crash, but all the time, on every activity that happens? Would help debugging a lot.

推荐答案

这样也可能对您有帮助


@implementation UIApplication (MyCategory)

+ (void)logStackTrace {
    @try {
        [[NSException exceptionWithName:@"Stack Trace" reason:@"Testing" userInfo:nil] raise];
    }
    @catch (NSException *e) {
        NSLog(@"%@", [e callStackSymbols]);
    }
}

@end

这篇关于打印当前堆栈跟踪的应用程序的简单方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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