gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-01 18:12:22 26 4
gpt4 key购买 nike

我在用户设备中遇到崩溃(我在 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

最佳答案

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

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

但就您而言,您在发布之前没有正确测试。

(这并没有真正提供答案,但我觉得你已经拥有为自己提供答案所需的一切,如果你愿意使用它的话)。

关于ios - 确定代码中发生崩溃的原因,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25697619/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com