我正在开发一个React Native(0.45.0)应用程序,并且在几个小时内我的应用程序崩溃(或者更确切地说是被看门狗杀死)和0x8badf00d。我明白为什么看门狗会杀死这个应用程序;主线程响应事件需要超过20秒。但我不知道如何在React Native中调试它。一切都在Javascript和promises中,所以我假设我正在做的网络执行已经异步。
应用程序似乎只是在后台运行时崩溃。但是,崩溃报告角色状态Foreground。我们正在使用后台获取和后台地理定位,它们都执行网络请求。我已经测量了从事件触发到结束的时间,总共不超过一秒。
我读到发生此错误的最常见问题是主要威胁的网络请求。可能是它尝试同步加载js包并挂起?当我的所有代码都在Javascript中时,如何调试此问题?
非常感谢你。
Incident Identifier: 36E63A5F-7C40-40C0-9914-2C9EAE494C11
Beta Identifier: 3C432B54-1947-470E-A387-6566A494E145
Hardware Model: iPhone7,2
Process: [993]
Path: /private/var/containers/Bundle/Application/70B3363C-32E9-4D26-B6C6-DB51304D46C7/.app/
Identifier: org.reactjs.native.example.Test3
Version: 20 (1.4)
Beta: YES
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: org.reactjs.native.example.Test3 [703]
Date/Time: 2017-07-17 21:31:33.1931 -0400
Launch Time: 2017-07-17 19:18:30.9574 -0400
OS Version: iPhone OS 10.3.2 (14F89)
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
0x0000000182a07224 0x182a06000 + 4644
1 libsystem_kernel.dylib
0x0000000182a0709c 0x182a06000 + 4252
2 CoreFoundation
0x00000001839d8e90 0x1838fe000 + 896656
3 CoreFoundation
0x00000001839d6ae4 0x1838fe000 + 887524
4 CoreFoundation
0x0000000183906da4 0x1838fe000 + 36260
5 GraphicsServices
0x0000000185370074 0x185364000 + 49268
6 UIKit
0x0000000189bc1058 0x189b4c000 + 479320
7
0x00000001000bfa08 0x1000b8000 + 31240
8 libdyld.dylib
0x000000018291559c 0x182911000 + 17820
更新,崩溃日志的符号化部分:
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x0000000182faf224 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x0000000182faf09c mach_msg + 72
2 CoreFoundation 0x0000000183f80e90 __CFRunLoopServiceMachPort + 192
3 CoreFoundation 0x0000000183f7eae4 __CFRunLoopRun + 1060
4 CoreFoundation 0x0000000183eaeda4 CFRunLoopRunSpecific + 424
5 GraphicsServices 0x0000000185918074 GSEventRunModal + 100
6 UIKit 0x000000018a169058 UIApplicationMain + 208
7 0x0000000100063294 0x10005c000 + 29332
8 libdyld.dylib 0x0000000182ebd59c start + 4