方式一

    **void** *callStack[128];
  **int** frames = backtrace(callStack, 128);
  **char** **strs = backtrace_symbols(callStack, frames);
  NSMutableArray *backtrace = [NSMutableArray arrayWithCapacity:frames];
  **for** (**int** i = 0; i < frames; i ++) {
    [backtrace addObject:[NSString stringWithUTF8String:strs[i]]];
  }
  free(strs);
  NSLog(@"\n====>>>仓库<<<===\n%@", backtrace);

成果

**====>>>仓库<<<===**
**14 (**
**0  EPIK                0x00000001044ba14c -[AppDelegate printCallStack] + 56,**
**1  EPIK                0x00000001044ba0f4 __57-[AppDelegate application:didFinishLaunchingWithOptions:]_block_invoke + 48,**
**2  libdispatch.dylib          0x00000001113b95f0 _dispatch_client_callout + 20,**
**3  libdispatch.dylib          0x00000001113bc4e4 _dispatch_continuation_pop + 584,**
**4  libdispatch.dylib          0x00000001113d0ef0 _dispatch_source_invoke + 1360,**
**5  libdispatch.dylib          0x00000001113c86d8 _dispatch_main_queue_callback_4CF + 560,**
**6  CoreFoundation           0x00000001a7c6b1e4 472C9193-115D-34CD-AD1D-0E7E091C9432 + 647652,**
**7  CoreFoundation           0x00000001a7c653b4 472C9193-115D-34CD-AD1D-0E7E091C9432 + 623540,**
**8  CoreFoundation           0x00000001a7c644bc CFRunLoopRunSpecific + 600,**
**9  GraphicsServices          0x00000001be6e9820 GSEventRunModal + 164,**
**10 UIKitCore              0x00000001aa608734 47154C6D-47DF-3ABB-A152-56B159B014E4 + 12048180,**
**11 UIKitCore              0x00000001aa60de10 UIApplicationMain + 168,**
**12 EPIK                0x00000001044c4f6c main + 128,**
**13 libdyld.dylib            0x00000001a792be60 90A4E82E-250C-35E3-8B2D-51D6D8B1119B + 3680,**
**)**

方式二

    NSArray *csss = [NSThread callStackSymbols];
    NSLog(@"\n====>>>仓库>>>===\n%@", csss);

成果

**====>>>仓库>>>===**
**14 (**
**0  EPIK                0x00000001044ba370 -[AppDelegate printThread] + 48,**
**1  EPIK                0x00000001044ba108 __57-[AppDelegate application:didFinishLaunchingWithOptions:]_block_invoke + 68,**
**2  libdispatch.dylib          0x00000001113b95f0 _dispatch_client_callout + 20,**
**3  libdispatch.dylib          0x00000001113bc4e4 _dispatch_continuation_pop + 584,**
**4  libdispatch.dylib          0x00000001113d0ef0 _dispatch_source_invoke + 1360,**
**5  libdispatch.dylib          0x00000001113c86d8 _dispatch_main_queue_callback_4CF + 560,**
**6  CoreFoundation           0x00000001a7c6b1e4 472C9193-115D-34CD-AD1D-0E7E091C9432 + 647652,**
**7  CoreFoundation           0x00000001a7c653b4 472C9193-115D-34CD-AD1D-0E7E091C9432 + 623540,**
**8  CoreFoundation           0x00000001a7c644bc CFRunLoopRunSpecific + 600,**
**9  GraphicsServices          0x00000001be6e9820 GSEventRunModal + 164,**
**10 UIKitCore              0x00000001aa608734 47154C6D-47DF-3ABB-A152-56B159B014E4 + 12048180,**
**11 UIKitCore              0x00000001aa60de10 UIApplicationMain + 168,**
**12 EPIK                0x00000001044c4f6c main + 128,**
**13 libdyld.dylib            0x00000001a792be60 90A4E82E-250C-35E3-8B2D-51D6D8B1119B + 3680,**
**)**