My Application not Listed in Crashed Thread

2

I've got a crash that, according to the crash report, isn't my fault. I wish that were true. I've Profiled the app with NSZombies and it hasn't happened there. Here are excerpts from the crash report:

Date/Time:           2015-11-23 19:40:34.34 -0600
Launch Time:         2015-11-23 18:49:43.43 -0600
OS Version:          iOS 9.1 (13B143)
Report Version:      104

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000c
Triggered by Thread:  7 

Thread 7 Crashed:
    0   libobjc.A.dylib                 0x34fcbac6 objc_msgSend + 6
    1   UIFoundation                    0x31e7242e +[NSStringDrawingTextStorageSettings threadSpecificStringDrawingTextStorageSettings:] + 62
    2   UIFoundation                    0x31e675de +[NSString(NSStringDrawing) typesetterBehavior] + 34
    3   UIFoundation                    0x31e68ae2 __NSStringDrawingEngine + 298
    4   UIFoundation                    0x31e68908 -[NSString(NSExtendedStringDrawing) drawWithRect:options:attributes:context:] + 144
    5   UIKit                           0x276aa488 -[UILabel _drawTextInRect:baselineCalculationOnly:] + 4864
    6   UIKit                           0x2771b40c -[UILabel drawTextInRect:] + 540
    7   UIKit                           0x2771b1e4 -[UILabel drawRect:] + 88
    8   UIKit                           0x2771b15e -[UIView(CALayerDelegate) drawLayer:inContext:] + 386
    9   QuartzCore                      0x26f8b6fc -[CALayer drawInContext:] + 228
    10  QuartzCore                      0x26f75088 CABackingStoreUpdate_ + 1852
    11  QuartzCore                      0x270619d0 ___ZN2CA5Layer8display_Ev_block_invoke + 52
    12  QuartzCore                      0x26f745c8 CA::Layer::display_() + 1168
    13  QuartzCore                      0x26f588a0 CA::Layer::display_if_needed(CA::Transaction*) + 204
    14  QuartzCore                      0x26f58560 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 24
    15  QuartzCore                      0x26f57a78 CA::Context::commit_transaction(CA::Transaction*) + 368
    16  QuartzCore                      0x26f5772a CA::Transaction::commit() + 614
    17  QuartzCore                      0x26f84ed2 CA::Transaction::release_thread(void*) + 310
    18  libsystem_pthread.dylib         0x3589e54c _pthread_tsd_cleanup + 508
    19  libsystem_pthread.dylib         0x3589e14e _pthread_exit + 86
    20  libsystem_pthread.dylib         0x3589db3c _pthread_wqthread + 1044
    21  libsystem_pthread.dylib         0x3589d718 start_wqthread + 8

My application isn't listed in here anywhere within the crashed thread. I have a few questions:

  1. How do I interpret this report to find the trigger of the crash? I see UILabels referenced in there, and I have plenty of those, how would I know which might be the cause?
  2. Is the crash one of the lines in the middle and the report is showing actions before and after to provide context?

Thank you for your help. This debugging is confusing stuff.

Update: 11/27/15:

Do I need to make sure a declaration like the following is done on the main thread:

UIView *lineView;

or only the modifications like the following:

lineView = [[UIView alloc] initWithFrame:CGRectMake(15, cell.contentView.frame.size.height - 1.0, cell.contentView.frame.size.width, 1)];

I'm having trouble determining what needs to be wrapped in GCD dispatches and what can be done on a background thread. I've been making changes per the suggested answer but I'm still getting the same crash.

Thanks.

ios
objective-c
xcode
crash-reports
asked on Stack Overflow Nov 24, 2015 by SteveSTL • edited Nov 27, 2015 by SteveSTL

1 Answer

4

You are crashing because you violated the rule that UIView descendants can only be manipulated on the main thread. Crashing isn't necessarily the only outcome, but in Apple's view, it's perfectly acceptable.

Fix your code so that it dispatches that bit of work to the main thread.

answered on Stack Overflow Nov 24, 2015 by Avi

User contributions licensed under CC BY-SA 3.0