iOS应用程序崩溃与EXC_BAD_ACCESS

时间:2015-08-24 13:14:02

标签: ios ios8 ctfont

最近我们的应用程序通过以下日志得到了一些崩溃。其他人遇到了同样的问题吗?任何帮助将不胜感激。

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Subtype: KERN_PROTECTION_FAILURE at 0x000000010000000c
Triggered by Thread:  0

Thread 0 name:
Thread 0 Crashed:
0   libdispatch.dylib               0x0000000197ed257c _dispatch_barrier_async_f_slow + 116 (atomic_llsc.h:3811)
1   libdispatch.dylib               0x0000000197ed2530 _dispatch_barrier_async_f_slow + 40 (queue.c:2251)
2   CoreText                        0x0000000187c7cfd8 CTFontTransformGlyphs + 400 (CTFont.cpp:2189)
3   UIFoundation                    0x000000019415aba8 __NSStringDrawingEngine + 13312 (NSStringDrawing.m:866)
4   UIFoundation                    0x0000000194157690 -[NSString(NSExtendedStringDrawing) drawWithRect:options:attributes:context:] + 180 (NSStringDrawing.m:2046)
5   UIKit                           0x000000018ba31bd4 -[UILabel _drawTextInRect:baselineCalculationOnly:] + 3516 (UILabel.m:2100)
6   UIKit                           0x000000018ba9e8e8 -[UILabel drawTextInRect:] + 512 (UILabel.m:1734)
7   UIKit                           0x000000018ba9e684 -[UIView(CALayerDelegate) drawLayer:inContext:] + 388 (UIView.m:9551)
8   QuartzCore                      0x000000018b3a1fdc -[CALayer drawInContext:] + 280 (CALayer.mm:8214)
9   QuartzCore                      0x000000018b38b584 CA::Layer::display_() + 528 (CALayer.mm:7994)
10  QuartzCore                      0x000000018b36cb38 CA::Layer::display_if_needed(CA::Transaction*) + 240 (CALayer.mm:2335)
11  QuartzCore                      0x000000018b36c7f0 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 40 (CALayer.mm:2358)
12  QuartzCore                      0x000000018b36bfe4 CA::Context::commit_transaction(CA::Transaction*) + 272 (CAContextInternal.cpp:1535)
13  QuartzCore                      0x000000018b36bd68 CA::Transaction::commit() + 432 (CATransactionInternal.cpp:393)
14  QuartzCore                      0x000000018b365798 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 76 (CATransactionInternal.cpp:735)
15  CoreFoundation                  0x0000000187252384 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 28 (CFRunLoop.c:1622)
16  CoreFoundation                  0x000000018724f310 __CFRunLoopDoObservers + 356 (CFRunLoop.c:1718)
17  CoreFoundation                  0x000000018724f6f0 __CFRunLoopRun + 832 (CFRunLoop.c:2548)
18  CoreFoundation                  0x000000018717d660 CFRunLoopRunSpecific + 392 (CFRunLoop.c:2795)
19  GraphicsServices                0x00000001902bf5a0 GSEventRunModal + 164 (GSEvent.c:2245)
20  UIKit                           0x000000018ba824f4 UIApplicationMain + 1484 (UIApplication.m:2926)
21  TestApp                         0x000000010004ffa0 main + 88 (main.m:16)
22  libdyld.dylib                   0x0000000197eeea04 start + 0 (start_glue.s:78)

谢谢!

1 个答案:

答案 0 :(得分:3)

在大多数情况下,

EXC_BAD_ACCESS 表示您正在尝试访问已取消分配的对象。为了调试这个,我建议添加“异常断点”,然后查看哪个变量不可访问。

要添加例外断点,您应该:

  1. Navigator 上的加号图标:
  2. enter image description here

    1. “添加异常断点”
    2. enter image description here

      如果你做的一切都正确,你会看到:

      enter image description here