What does this crash report mean?

2019-04-17 22:13发布

问题:

I am getting this crash log from my release build but have a hard time figuring out what this means.

Is this UIKit crashing because the label got removed from superview while it was being animated?

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x000000000000defe
Crashed Thread:  0

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   UIKit                           0x36011c7e -[UIView release] + 54
1   UIKit                           0x3603d12c -[UIView dealloc] + 292
2   TestApp                         0x0011fb0e -[ValueLabel .cxx_destruct] (ValueLabel.m:47)
3   libobjc.A.dylib                 0x3beeff26 object_cxxDestructFromClass(objc_object*, objc_class*) + 54
4   libobjc.A.dylib                 0x3beed0de objc_destructInstance + 30
5   libobjc.A.dylib                 0x3beed3ae object_dispose + 10
6   UIKit                           0x3603d2e2 -[UIView dealloc] + 730
7   TestApp                         0x0011fa48 -[ValueLabel dealloc] (ValueLabel.m:306)
8   libsystem_blocks.dylib          0x3c32bab0 _Block_release + 220
9   UIKit                           0x360255e0 -[UIViewAnimationBlockDelegate dealloc] + 56
10  CoreFoundation                  0x341406da CFRelease + 98
11  CoreFoundation                  0x34161d78 -[__NSDictionaryI dealloc] + 128
12  libobjc.A.dylib                 0x3beed490 (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 164
13  CoreFoundation                  0x3414282c _CFAutoreleasePoolPop + 12
14  CoreFoundation                  0x341d31b2 __CFRunLoopRun + 1290
15  CoreFoundation                  0x34146238 CFRunLoopRunSpecific + 352
16  CoreFoundation                  0x341460c4 CFRunLoopRunInMode + 100
17  GraphicsServices                0x37d24336 GSEventRunModal + 70
18  UIKit                           0x360622b4 UIApplicationMain + 1116
19  TestApp                         0x000e6cae main (main.m:16)
20  TestApp                         0x000e6c64 start + 36

回答1:

If you are removing views instantiated in Storyboard or NIBs, make sure the IBOutlet properties are strong or retain rather than weak or assign, otherwise they will be released as soon as they are removed from the parent view.

This is

@property (nonatomic, strong) IBOutlet UILabel* labelToRemove;

rather than

@property (nonatomic, weak) IBOutlet UILabel* labelToRemove;