如何阅读此iOS stacktrace?

时间:2019-03-04 10:33:08

标签: ios objective-c swift react-native stack-trace

我通常使用Javascript和Python之类的高级语言进行开发,因此在读取较低级别的堆栈跟踪时我并不那么有经验。我正在使用React Native构建iOS应用程序,有时我的应用程序意外崩溃。阅读崩溃日志,这就是我得到的:

Incident Identifier: B03D5F95-EFD1-4FEB-AE18-C8EFEF273E53
CrashReporter Key:   6049c1cc93a2e0163265631aa6cc2fd30a1af6e7
Hardware Model:      iPhone7,2
Process:             MyApp [24268]
Path:                /private/var/containers/Bundle/Application/99B2B9A1-D266-4222-A083-84C4CFFCE182/MyApp.app/MyApp
Identifier:          org.mycompany.MyApp
Version:             1 (1.0)
Code Type:           ARM-64 (Native)
Role:                Non UI
Parent Process:      launchd [1]
Coalition:           org.mycompany.MyApp [3119]


Date/Time:           2019-03-04 14:20:18.4924 +0800
Launch Time:         2019-03-04 14:09:15.2536 +0800
OS Version:          iPhone OS 11.0.3 (15A432)
Baseband Version:    6.17.00
Report Version:      104

Exception Type:  EXC_CRASH (SIGKILL)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Termination Reason: Namespace <0xF>, Code 0x8badf00d
Triggered by Thread:  0

Filtered syslog:
None found

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib          0x0000000180a60bc4 mach_msg_trap + 8
1   libsystem_kernel.dylib          0x0000000180a60a3c mach_msg + 72
2   BackBoardServices               0x00000001835d0de0 _BKSHIDGetCurrentDisplayBrightness + 112
3   BackBoardServices               0x00000001835de9cc BKSDisplayBrightnessGetCurrent + 32
4   FrontBoardServices              0x00000001835fffc0 -[FBSUIApplicationSystemService currentBacklightLevel] + 12
5   UIKit                           0x000000018a8a3d44 -[UIDevice _backlightLevel] + 44
6   UIKit                           0x000000018a8aced4 -[UIScreen _postBrightnessDidChangeNotificationIfAppropriate] + 168
7   CoreFoundation                  0x0000000180efa12c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 20
8   CoreFoundation                  0x0000000180efa090 ___CFXRegistrationPost_block_invoke + 64
9   CoreFoundation                  0x0000000180f1016c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 20
10  CoreFoundation                  0x0000000180f0fa3c __CFRunLoopDoBlocks + 288
11  CoreFoundation                  0x0000000180f0dca4 __CFRunLoopRun + 2436
12  CoreFoundation                  0x0000000180e2e2d8 CFRunLoopRunSpecific + 436
13  GraphicsServices                0x0000000182cbff84 GSEventRunModal + 100
14  UIKit                           0x000000018a3db880 UIApplicationMain + 208
15  MyApp                           0x00000001005833d4 main + 29652 (main.m:14)
16  libdyld.dylib                   0x000000018095256c start + 4

如何/从哪里开始阅读崩溃日志?我相信它与mach_msg_trap有关,但我至今仍未找到任何相关信息。在某些情况下,我的应用是使用后台地理位置跟踪来跟踪用户地理位置的应用。我无法找出导致崩溃的原因。

2 个答案:

答案 0 :(得分:2)

请参见TN2141: Understanding and Analyzing Application Crash Reports,其中说:

  

异常代码0x8badf00d表示应用程序已被iOS终止,因为发生了看门狗超时。该应用程序启动,终止或响应系统事件所需的时间过长。 ...线程0上的任何操作都需要移至后台线程,或进行不同的处理,以免阻塞主线程。

您是否正在做任何可能长时间阻塞主线程的事情?

答案 1 :(得分:0)

您是否已添加“隐私-位置”在info.plist中?

类似的东西。

<key>NSLocationAlwaysUsageDescription</key>
<string>Why you need track location?</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Why you need track location?</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Why you need track location?</string>

我看到您正在使用背景地理位置跟踪。您是否在功能中启用了后台模式?

如果不只是添加“隐私”,请打开“后台模式”,然后重试。