iOS 打印函数调用堆栈

打印调用堆栈可以借助于: callStackSymbols

NSArray *syms = [NSThread  callStackSymbols];
if ([syms count] > 1) {
    NSLog(@"<%@ %p> %@ - caller: %@ ", [self class], self, NSStringFromSelector(_cmd),[syms objectAtIndex:1]);
} else {
     NSLog(@"<%@ %p> %@", [self class], self, NSStringFromSelector(_cmd));
}

你可能感兴趣的:(iOS 打印函数调用堆栈)