ios - Is it possible to get which class thrown the exception? -
is possible class thrown exception @ runtime?
if so, how it?
what want detect class did throw exception. i'm using nssetuncaughtexceptionhandler(nsuncaughtexceptionhandler *) detect if app crashes. that, have nsexception , want know class throws it.
also, not debugging purposes.
#pragma mark - exception handler void handleexception(nsexception *exception) { // handle exception } void installuncaughtexceptionhandler() { nssetuncaughtexceptionhandler(&handleexception); //signal(sigsys, sig_dfl); for(int x = 1; x <= 30; x++) { signal(x, sig_dfl); } }
you can read stack trace +callstacksymbols
(nsexception
) inside exception handler. last entries system calls. beneath find thrower.
@try { … } @catch (nsexception *e) { nslog( @"%@", [e callstacksymbols] ); }
Comments
Post a Comment