什么是调用堆栈?调用堆栈简单的讲就是程序从开始运行到当前函数(方法)之间,所有调用过的函数(方法)的前后顺序.
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
//打印调用堆栈
NSLog(@"%@",[NSThread callStackSymbols]);
}
@end
打印调用堆栈结果: