CFRunLoop调用Source0执行功能崩溃

时间:2020-02-07 12:21:21

标签: ios swift lldb

App有时会崩溃,但我无法重现此案。我正在尝试检查日志并查找导致崩溃的代码块。以下是我崩溃的主要威胁。我认为CFRunLoop Is Calling Out To A Source0 Perform Function行(第23行)会导致崩溃,但我不确定。如何找到相关功能?

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib          0x0000000185fa416c mach_msg_trap + 8
1   libsystem_kernel.dylib          0x0000000185fa3fdc mach_msg + 72
2   CoreFoundation                  0x0000000186fa1cec __CFRunLoopServiceMachPort + 192
3   CoreFoundation                  0x0000000186f9f908 __CFRunLoopRun + 1132
4   CoreFoundation                  0x0000000186ece048 CFRunLoopRunSpecific + 444
5   Foundation                      0x00000001879dcb1c -[NSRunLoop+ 51996 (NSRunLoop) runMode:beforeDate:] + 304
6   MyAppTargetName                 0x0000000100c05464 0x100084000 + 12063844
7   MyAppTargetName                 0x0000000100b70408 0x100084000 + 11453448
8   MyAppTargetName                 0x0000000100b7ef64 0x100084000 + 11513700
9   MyAppTargetName                 0x000000010076b6e4 0x100084000 + 7239396
10  MyAppTargetName                 0x000000010076aec0 0x100084000 + 7237312
11  MyAppTargetName                 0x000000010076b11c 0x100084000 + 7237916
12  MyAppTargetName                 0x0000000100569c28 0x100084000 + 5135400
13  UIKit                           0x000000018d09e7ac -[UIApplication _sendWillEnterForegroundCallbacks] + 172
14  UIKit                           0x000000018d0d9ccc -[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:] + 2140
15  UIKit                           0x000000018d0d91fc -[UIApplication _handleApplicationLifecycleEventWithScene:transitionContext:completion:] + 452
16  UIKit                           0x000000018d0c48f8 __70-[UIApplication scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke + 152
17  UIKit                           0x000000018d0c457c -[UIApplication scene:didUpdateWithDiff:transitionContext:completion:] + 888
18  UIKit                           0x000000018d3f5e44 -[UIApplicationSceneClientAgent scene:handleEvent:withCompletion:] + 464
19  FrontBoardServices              0x0000000188b67b8c __80-[FBSSceneImpl updater:didUpdateSettings:withDiff:transitionContext:completion:]_block_invoke.376 + 208
20  FrontBoardServices              0x0000000188b958bc __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 36
21  FrontBoardServices              0x0000000188b95728 -[FBSSerialQueue _performNext] + 176
22  FrontBoardServices              0x0000000188b95ad0 -[FBSSerialQueue _performNextFromRunLoopSource] + 56
23  CoreFoundation                  0x0000000186fa2278 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
24  CoreFoundation                  0x0000000186fa1bc0 __CFRunLoopDoSources0 + 524
25  CoreFoundation                  0x0000000186f9f7c0 __CFRunLoopRun + 804
26  CoreFoundation                  0x0000000186ece048 CFRunLoopRunSpecific + 444
27  GraphicsServices                0x0000000188951198 GSEventRunModal + 180
28  UIKit                           0x000000018cea8628 -[UIApplication _run] + 684
29  UIKit                           0x000000018cea3360 UIApplicationMain + 208
30  MyAppTargetName                 0x0000000100523e68 0x100084000 + 4849256
31  libdyld.dylib                   0x0000000185eb05b8 start + 4

1 个答案:

答案 0 :(得分:2)

__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__仅表示“最终称为“运行循环”。这几乎意味着“您的应用正在运行”。这不是错误的一部分。

此部分中的错误是您需要用符号表示的:

6   MyAppTargetName                 0x0000000100c05464 0x100084000 + 12063844
7   MyAppTargetName                 0x0000000100b70408 0x100084000 + 11453448
8   MyAppTargetName                 0x0000000100b7ef64 0x100084000 + 11513700
9   MyAppTargetName                 0x000000010076b6e4 0x100084000 + 7239396
10  MyAppTargetName                 0x000000010076aec0 0x100084000 + 7237312
11  MyAppTargetName                 0x000000010076b11c 0x100084000 + 7237916
12  MyAppTargetName                 0x0000000100569c28 0x100084000 + 5135400

我对您的代码中立即出现的这个框架感到怀疑,但是:

5   Foundation                      0x00000001879dcb1c -[NSRunLoop+ 51996 (NSRunLoop) runMode:beforeDate:] + 304

这可能意味着您的代码正在尝试直接处理runloop,这在技术上是合法的,但它是一种非常先进的技术,可能会引起严重的问题。但是您需要在symbolication之后查看自己的代码。