我想在某些时间点记录调用跟踪,例如失败的断言或未捕获的异常。
最佳答案
此代码适用于任何线程:
NSLog(@"%@", NSThread.callStackSymbols);
Returns an array containing the call stack symbols. Each element is an
NSString
object with a value in a format determined by thebacktrace_symbols()
function.
https://stackoverflow.com/questions/220159/