确定我的代码中发生崩溃的原因

时间:2014-09-06 06:44:46

标签: ios crash

我在用户的设备中崩溃(我在Crashalytics中看到它) 问题是核心转储是所有iOS内部的东西。 我如何才能看到我的代码中的哪些内容产生了导致崩溃的绘图?

Terminating app due to an uncaught exception 'NSInvalidArgumentException', reason: '-[NSAttributeDictionary textContainerForAttributedString:containerSize:lineFragmentPadding:]: unrecognized selector sent to instance 0x15dc7f20'
0   CoreFoundation  0x30065f23  +154
1   libobjc.A.dylib 0x3a7fcce7  objc_exception_throw+38
2   CoreFoundation  0x30069837  +202
3   CoreFoundation  0x30068137  +706
4   CoreFoundation  0x2ffb7098  _CF_forwarding_prep_0+24
5   UIFoundation    0x37ce5915  +12252
6   UIFoundation    0x37ce2863  +150
7   UIKit   0x328ae2c9  +4224
8   UIKit   0x32914709  +500
9   UIKit   0x3291450b  +78
10  UIKit   0x329144a9  +372
11  QuartzCore  0x32540189  +100
12  QuartzCore  0x32529c5b  +1858
13  QuartzCore  0x32605c1d  +52
14  QuartzCore  0x3252950b  +82
15  QuartzCore  0x325291bf  +1118
16  QuartzCore  0x3250cd41  +208
17  QuartzCore  0x3250c9d9  +24
18  QuartzCore  0x3250c3e5  +228
19  QuartzCore  0x3250c1f7  +314
20  QuartzCore  0x325398e3  +162
21  libsystem_pthread.dylib 0x3ae176d1  +164
22  libsystem_pthread.dylib 0x3ae17453  +86
23  libsystem_pthread.dylib 0x3ae181b9  pthread_exit+28
24  Foundation  0x309a2703  +10
25  Foundation  0x30a4ea2d  +1092
26  libsystem_pthread.dylib 0x3ae18959  +140
27  libsystem_pthread.dylib 0x3ae188cb  _pthread_start+102

**编辑** 在此次运行中崩溃的另一个线程(这再次没有提示我的代码中的原始点)

Thread : Crashed: Thread
0  libsystem_c.dylib              0x3ad6206a __abort + 101
1  libsystem_c.dylib              0x3ad6206b __abort + 102
2  libsystem_c.dylib              0x3ad62005 __abort
3  libc++abi.dylib                0x3a1b098f abort_message + 74
4  libc++abi.dylib                0x3a1c96e7 default_terminate_handler() + 254
5  libobjc.A.dylib                0x3a7fcf7d _objc_terminate() + 192
6  libc++abi.dylib                0x3a1c71b3 std::__terminate(void (*)()) + 78
7  libc++abi.dylib                0x3a1c6a09 __cxxabiv1::exception_cleanup_func(_Unwind_Reason_Code, _Unwind_Exception*)
8  libobjc.A.dylib                0x3a7fcdbb objc_exception_throw + 250
9  CoreFoundation                 0x30069837 -[NSObject(NSObject) doesNotRecognizeSelector:] + 202
10 CoreFoundation                 0x30068137 ___forwarding___ + 706
11 CoreFoundation                 0x2ffb7098 _CF_forwarding_prep_0 + 24
12 UIFoundation                   0x37ce5915 __NSStringDrawingEngine + 12252
13 UIFoundation                   0x37ce2863 -[NSString(NSExtendedStringDrawing) drawWithRect:options:attributes:context:] + 150
14 UIKit                          0x328ae2c9 -[UILabel _drawTextInRect:baselineCalculationOnly:] + 4224
15 UIKit                          0x32914709 -[UILabel drawTextInRect:] + 500
16 UIKit                          0x3291450b -[UILabel drawRect:] + 78
17 UIKit                          0x329144a9 -[UIView(CALayerDelegate) drawLayer:inContext:] + 372
18 QuartzCore                     0x32540189 -[CALayer drawInContext:] + 100
19 QuartzCore                     0x32529c5b CABackingStoreUpdate_ + 1858
20 QuartzCore                     0x32605c1d ___ZN2CA5Layer8display_Ev_block_invoke + 52
21 QuartzCore                     0x3252950b x_blame_allocations + 82
22 QuartzCore                     0x325291bf CA::Layer::display_() + 1118
23 QuartzCore                     0x3250cd41 CA::Layer::display_if_needed(CA::Transaction*) + 208
24 QuartzCore                     0x3250c9d9 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 24
25 QuartzCore                     0x3250c3e5 CA::Context::commit_transaction(CA::Transaction*) + 228
26 QuartzCore                     0x3250c1f7 CA::Transaction::commit() + 314
27 QuartzCore                     0x325398e3 CA::Transaction::release_thread(void*) + 162
28 libsystem_pthread.dylib        0x3ae176d1 _pthread_tsd_cleanup + 164
29 libsystem_pthread.dylib        0x3ae17453 _pthread_exit + 86
30 libsystem_pthread.dylib        0x3ae181b9 pthread_exit + 28
31 Foundation                     0x309a2703 +[NSThread exit] + 10
32 Foundation                     0x30a4ea2d __NSThread__main__ + 1092
33 libsystem_pthread.dylib        0x3ae18959 _pthread_body + 140
34 libsystem_pthread.dylib        0x3ae188cb _pthread_start + 102

1 个答案:

答案 0 :(得分:0)

不寻常的是,你只是在生产中而不是在开发中遇到这种崩溃。这可能是由于测试不佳,但另一个可能的原因是对您正在使用的数据类型做出假设,而且这些数据很难在开发中复制。

JSON是一个常见的经典示例,其中服务器可以提供一个神奇地转换为对象层次结构的字符串响应。然后代码假定顶级对象是字典或数组,并开始调用无法识别的方法。

但是,在您的情况下,您在发布之前没有正确测试。

(这并没有真正提供答案,但我觉得如果你不愿意使用答案,你就拥有了提供答案所需的一切。)