How to get source code line from stack trace in obj-c / ios

后端 未结 4 1515
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-05 06:31

I use NSSetUncaughtExceptionHandler to print the stack trace to local file in iPhone, which will be sent to our server next time the app launches. Then I can examin

4条回答
  •  没有蜡笔的小新
    2021-02-05 06:36

    Print the stack trace stored in the exception, i.e. [exception callStackSymbols] or [exception callStackReturnAddresses]. In Apple's crash logs since iOS 5, this shows up at the top as "Last Exception Backtrace".

    What you're seeing is the call stack when the exception is re-thrown, which will happen for things as simple as try...finally. I'm not sure exactly why Apple made this change (possibly to make run loops exception-safe?), but there you go.

提交回复
热议问题