gpt4 book ai didi

iOS 崩溃报告 : EXC_CRASH (SIGABRT) - stringByAppendingString

转载 作者:行者123 更新时间:2023-11-29 11:40:54 51 4
gpt4 key购买 nike

我正在尝试修复一个我无法重现的错误,它不会发生在我的设备(iPhone 5s)或任何 iOS 模拟器中,但只在我客户的 iPhone 7 中发生过一次。当客户端删除并重新下载该应用程序时,错误消失了,所以我现在正在寻找幽灵。

我能够从客户端手机获取崩溃日志文件并将其符号化。以下是我提取的一些有用信息:

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 0

在未符号化的崩溃报告中:(检查第 2 行和第 3 行)

Last Exception Backtrace:
0 CoreFoundation 0x18c92efe0 __exceptionPreprocess + 124
1 libobjc.A.dylib 0x18b390538 objc_exception_throw + 56
2 CoreFoundation 0x18c92ef28 +[NSException raise:format:] + 116
3 Foundation 0x18d324df0 -[NSString stringByAppendingString:] + 112
4 myApp 0x100119ea8 0x100004000 + 1138344
5 myApp 0x100119784 0x100004000 + 1136516
6 UIKit 0x192ad1204 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 380
7 UIKit 0x192cdd738 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3452
8 UIKit 0x192ce31e0 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1684
9 UIKit 0x192cf7d18 __84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke.3151 + 48
10 UIKit 0x192ce0474 -[UIApplication workspaceDidEndTransaction:] + 168
11 FrontBoardServices 0x18e4d7884 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 36
12 FrontBoardServices 0x18e4d76f0 -[FBSSerialQueue _performNext] + 176
13 FrontBoardServices 0x18e4d7aa0 -[FBSSerialQueue _performNextFromRunLoopSource] + 56
14 CoreFoundation 0x18c8dd42c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
15 CoreFoundation 0x18c8dcd9c __CFRunLoopDoSources0 + 540
16 CoreFoundation 0x18c8da9a8 __CFRunLoopRun + 744
17 CoreFoundation 0x18c80ada4 CFRunLoopRunSpecific + 424
18 UIKit 0x192aca384 -[UIApplication _run] + 652
19 UIKit 0x192ac5058 UIApplicationMain + 208
20 myApp 0x10014b8ac 0x100004000 + 1341612
21 libdyld.dylib 0x18b81959c start + 4

并在符号化的崩溃报告中:(检查第 4 行和第 5 行)

Last Exception Backtrace:
0 CoreFoundation 0x185f7fd38 0x185e3e000 + 1318200
1 libobjc.A.dylib 0x185494528 0x18548c000 + 34088
2 CoreFoundation 0x185f7fc80 0x185e3e000 + 1318016
3 Foundation 0x18686e760 0x186862000 + 51040
4 myApp 0x10469f928 -[AppDelegate initViewController] (AppDelegate.m:96)
5 myApp 0x10469f520 -[AppDelegate application:didFinishLaunchingWithOptions:] (AppDelegate.m:30)
6 UIKit 0x18f3ff050 0x18f380000 + 520272
7 UIKit 0x18f5f2898 0x18f380000 + 2566296
8 UIKit 0x18f5f76e4 0x18f380000 + 2586340
9 UIKit 0x18f885454 0x18f380000 + 5264468
10 UIKit 0x18fb551f0 0x18f380000 + 8212976
11 UIKit 0x18f8850b8 0x18f380000 + 5263544
12 UIKit 0x18f885928 0x18f380000 + 5265704
13 UIKit 0x18ffee6e8 0x18f380000 + 13035240
14 UIKit 0x18ffee58c 0x18f380000 + 13034892
15 UIKit 0x18fd6a9c0 0x18f380000 + 10398144
16 UIKit 0x18fefffc8 0x18f380000 + 12058568
17 UIKit 0x18fd6a870 0x18f380000 + 10397808
18 UIKit 0x18fb54850 0x18f380000 + 8210512
19 UIKit 0x18f5f5e28 0x18f380000 + 2580008
20 UIKit 0x18f9f96ec 0x18f380000 + 6788844
21 FrontBoardServices 0x188621768 0x188615000 + 51048
22 FrontBoardServices 0x18862a070 0x188615000 + 86128
23 libdispatch.dylib 0x185905048 0x185904000 + 4168
24 libdispatch.dylib 0x18590c6c8 0x185904000 + 34504
25 FrontBoardServices 0x188655a04 0x188615000 + 264708
26 FrontBoardServices 0x1886556a8 0x188615000 + 263848
27 FrontBoardServices 0x188655c44 0x188615000 + 265284
28 CoreFoundation 0x185f28358 0x185e3e000 + 959320
29 CoreFoundation 0x185f282d8 0x185e3e000 + 959192
30 CoreFoundation 0x185f27b60 0x185e3e000 + 957280
31 CoreFoundation 0x185f25738 0x185e3e000 + 948024
32 CoreFoundation 0x185e462d8 0x185e3e000 + 33496
33 GraphicsServices 0x187cd7f84 0x187ccd000 + 44932
34 UIKit 0x18f3f3880 0x18f380000 + 473216
35 myApp 0x1046bc124 main (main.m:14)
36 libdyld.dylib 0x18596a56c 0x185969000 + 5484

所以在未符号化的崩溃报告的第三行它说:

0x18d324df0 -[NSString stringByAppendingString:] + 112

在符号化的崩溃报告的第 4 行:

0x10469f928 -[AppDelegate initViewController] (AppDelegate.m:96)

在我的 AppDelegate 的第 96 行,我有这段代码:

NSString *backColorString = [@"#" stringByAppendingString:[myModel sharedInstance].theme.BackColor];

所以唯一可能有问题的是,如果问题确实在这里(?)是

[HotelStay sharedInstance].theme.BackColor

必须返回 nil 或 "".

问题是我都试过了,但我无法重现问题。我在这里遗漏了什么或做错了什么吗?

最佳答案

如果您在 NSString 上使用 stringByAppendingString ,那么您最终会遇到泄漏,因为与初始 NSString 相关联的指针四处移动,指向由追加创建的新字符串,而对于 NSMutableString,您的指针始终指向该可变字符串。我想这应该是问题所在,但我的想法是根据 Apple 文档 附加到接收器的字符串。此值不能为 nil,如果它为 nil,则会引发 NSInvalidArgumentException

关于iOS 崩溃报告 : EXC_CRASH (SIGABRT) - stringByAppendingString,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46604418/

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