更新到 Xcode 11.0 后反应本机崩溃

react native crash after update to Xcode 11.0

我刚刚将 Xcode 更新到版本 11.0,现在当我 运行 我的来自 Xcode 的反应本机应用程序在我插入 iPhone 时,应用程序崩溃了在本机调用上:

2019-10-11 09:52:42.402 [fatal][tid:main] Exception '*** -[__NSArrayM objectAtIndexedSubscript:]: index 1 beyond bounds [0 .. 0]' was thrown while invoking getCurrentAppState on target AppState with params (
    2,
    3
)
callstack: (
    0   CoreFoundation                      0x000000020ae29294 <redacted> + 252
    1   libobjc.A.dylib                     0x000000020a0039f8 objc_exception_throw + 56
    2   CoreFoundation                      0x000000020ada2ce8 _CFArgv + 0
    3   CoreFoundation                      0x000000020ad27cfc <redacted> + 0
    4   MyApp                      0x000000010084dfac -[RCTModuleMethod processMethodSignature] + 10144
    5   MyApp                      0x00000001008526d4 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 164
    6   MyApp                      0x00000001008e488c _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 660
    7   MyApp                      0x00000001008e4400 _ZZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEiENK3$_0clEv + 144
    8   MyApp                      0x00000001008e4364 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 28
    9   libdispatch.dylib                   0x0000000101dcb6f0 _dispatch_call_block_and_release + 24
    10  libdispatch.dylib                   0x0000000101dccc74 _dispatch_client_callout + 16
    11  libdispatch.dylib                   0x0000000101dda6fc _dispatch_main_queue_callback_4CF + 1360
    12  CoreFoundation                      0x000000020adbac1c <redacted> + 12
    13  CoreFoundation                      0x000000020adb5b54 <redacted> + 1924
    14  CoreFoundation                      0x000000020adb50b0 CFRunLoopRunSpecific + 436
    15  Foundation                          0x000000020b782fac <redacted> + 300
    16  Foundation                          0x000000020b782e3c <redacted> + 96
    17  MyApp                      0x0000000100796c94 +[RNSplashScreen show] + 308
    18  MyApp                      0x00000001006e4d7c -[AppDelegate application:didFinishLaunchingWithOptions:] + 444
    19  UIKitCore                           0x00000002375dbe30 <redacted> + 412
    20  UIKitCore                           0x00000002375dd594 <redacted> + 3352
    21  UIKitCore                           0x00000002375e2d20 <redacted> + 1540
    22  UIKitCore                           0x0000000236ea62dc <redacted> + 776
    23  UIKitCore                           0x0000000236eae874 <redacted> + 160
    24  UIKitCore                           0x0000000236ea5f60 <redacted> + 236
    25  UIKitCore                           0x0000000236ea6850 <redacted> + 1064
    26  UIKitCore                           0x0000000236ea4b9c <redacted> + 744
    27  UIKitCore                           0x0000000236ea4864 <redacted> + 428
    28  UIKitCore                           0x0000000236ea93a4 <redacted> + 220
    29  UIKitCore                           0x0000000236eaa188 _performActionsWithDelayForTransitionContext + 112
    30  UIKitCore                           0x0000000236ea925c <redacted> + 244
    31  UIKitCore                           0x0000000236eadf5c <redacted> + 360
    32  UIKitCore                           0x00000002375e1328 <redacted> + 540
    33  UIKitCore                           0x00000002371ddba8 <redacted> + 360
    34  FrontBoardServices                  0x000000020d7a49fc <redacted> + 440
    35  FrontBoardServices                  0x000000020d7ae40c <redacted> + 256
    36  FrontBoardServices                  0x000000020d7adc14 <redacted> + 64
    37  libdispatch.dylib                   0x0000000101dccc74 _dispatch_client_callout + 16
    38  libdispatch.dylib                   0x0000000101dd0840 _dispatch_block_invoke_direct + 232
    39  FrontBoardServices                  0x000000020d7df040 <redacted> + 40
    40  FrontBoardServices                  0x000000020d7decdc <redacted> + 408
    41  FrontBoardServices                  0x000000020d7df294 <redacted> + 52
    42  CoreFoundation                      0x000000020adbb018 <redacted> + 24
    43  CoreFoundation                      0x000000020adbaf98 <redacted> + 88
    44  CoreFoundation                      0x000000020adba880 <redacted> + 176
    45  CoreFoundation                      0x000000020adb57bc <redacted> + 1004
    46  CoreFoundation                      0x000000020adb50b0 CFRunLoopRunSpecific + 436
    47  GraphicsServices                    0x000000020cfb579c GSEventRunModal + 104
    48  UIKitCore                           0x00000002375e4978 UIApplicationMain + 212
    49  MyApp                      0x00000001006e551c main + 124
    50  libdyld.dylib                       0x000000020a87a8e0 <redacted> + 4
)
2019-10-11 09:52:42.407068+0200 MyApp[309:11033] Exception '*** -[__NSArrayM objectAtIndexedSubscript:]: index 1 beyond bounds [0 .. 0]' was thrown while invoking getCurrentAppState on target AppState with params (
    2,
    3
)
callstack: (
    0   CoreFoundation                      0x000000020ae29294 <redacted> + 252
    1   libobjc.A.dylib                     0x000000020a0039f8 objc_exception_throw + 56
    2   CoreFoundation                      0x000000020ada2ce8 _CFArgv + 0
    3   CoreFoundation                      0x000000020ad27cfc <redacted> + 0
    4   MyApp                      0x000000010084dfac -[RCTModuleMethod processMethodSignature] + 10144
    5   MyApp                      0x00000001008526d4 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 164
    6   MyApp                      0x00000001008e488c _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 660
    7   MyApp                      0x00000001008e4400 _ZZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEiENK3$_0clEv + 144
    8   MyApp                      0x00000001008e4364 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 28
    9   libdispatch.dylib                   0x0000000101dcb6f0 _dispatch_call_block_and_release + 24
    10  libdispatch.dylib                   0x0000000101dccc74 _dispatch_client_callout + 16
    11  libdispatch.dylib                   0x0000000101dda6fc _dispatch_main_queue_callback_4CF + 1360
    12  CoreFoundation                      0x000000020adbac1c <redacted> + 12
    13  CoreFoundation                      0x000000020adb5b54 <redacted> + 1924
    14  CoreFoundation                      0x000000020adb50b0 CFRunLoopRunSpecific + 436
    15  Foundation                          0x000000020b782fac <redacted> + 300
    16  Foundation                          0x000000020b782e3c <redacted> + 96
    17  MyApp                      0x0000000100796c94 +[RNSplashScreen show] + 308
    18  MyApp                      0x00000001006e4d7c -[AppDelegate application:didFinishLaunchingWithOptions:] + 444
    19  UIKitCore                           0x00000002375dbe30 <redacted> + 412
    20  UIKitCore                           0x00000002375dd594 <redacted> + 3352
    21  UIKitCore                           0x00000002375e2d20 <redacted> + 1540
    22  UIKitCore                           0x0000000236ea62dc <redacted> + 776
    23  UIKitCore                           0x0000000236eae874 <redacted> + 160
    24  UIKitCore                           0x0000000236ea5f60 <redacted> + 236
    25  UIKitCore                           0x0000000236ea6850 <redacted> + 1064
    26  UIKitCore                           0x0000000236ea4b9c <redacted> + 744
    27  UIKitCore                           0x0000000236ea4864 <redacted> + 428
    28  UIKitCore                           0x0000000236ea93a4 <redacted> + 220
    29  UIKitCore                           0x0000000236eaa188 _performActionsWithDelayForTransitionContext + 112
    30  UIKitCore                           0x0000000236ea925c <redacted> + 244
    31  UIKitCore                           0x0000000236eadf5c <redacted> + 360
    32  UIKitCore                           0x00000002375e1328 <redacted> + 540
    33  UIKitCore                           0x00000002371ddba8 <redacted> + 360
    34  FrontBoardServices                  0x000000020d7a49fc <redacted> + 440
    35  FrontBoardServices                  0x000000020d7ae40c <redacted> + 256
    36  FrontBoardServices                  0x000000020d7adc14 <redacted> + 64
    37  libdispatch.dylib                   0x0000000101dccc74 _dispatch_client_callout + 16
    38  libdispatch.dylib                   0x0000000101dd0840 _dispatch_block_invoke_direct + 232
    39  FrontBoardServices                  0x000000020d7df040 <redacted> + 40
    40  FrontBoardServices                  0x000000020d7decdc <redacted> + 408
    41  FrontBoardServices                  0x000000020d7df294 <redacted> + 52
    42  CoreFoundation                      0x000000020adbb018 <redacted> + 24
    43  CoreFoundation                      0x000000020adbaf98 <redacted> + 88
    44  CoreFoundation                      0x000000020adba880 <redacted> + 176
    45  CoreFoundation                      0x000000020adb57bc <redacted> + 1004
    46  CoreFoundation                      0x000000020adb50b0 CFRunLoopRunSpecific + 436
    47  GraphicsServices                    0x000000020cfb579c GSEventRunModal + 104
    48  UIKitCore                           0x00000002375e4978 UIApplicationMain + 212
    49  MyApp                      0x00000001006e551c main + 124
    50  libdyld.dylib                       0x000000020a87a8e0 <redacted> + 4
)

2019-10-11 09:52:43.027 [fatal][tid:main] Exception '*** -[__NSArrayM objectAtIndexedSubscript:]: index 1 beyond bounds [0 .. 0]' was thrown while invoking getInitialNotification on target PushNotificationManager with params (
    148,
    149
)
callstack: (
    0   CoreFoundation                      0x000000020ae29294 <redacted> + 252
    1   libobjc.A.dylib                     0x000000020a0039f8 objc_exception_throw + 56
    2   CoreFoundation                      0x000000020ada2ce8 _CFArgv + 0
    3   CoreFoundation                      0x000000020ad27cfc <redacted> + 0
    4   MyApp                      0x000000010084dfac -[RCTModuleMethod processMethodSignature] + 10144
    5   MyApp                      0x00000001008526d4 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 164
    6   MyApp                      0x00000001008e488c _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 660
    7   MyApp                      0x00000001008e4400 _ZZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEiENK3$_0clEv + 144
    8   MyApp                      0x00000001008e4364 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 28
    9   libdispatch.dylib                   0x0000000101dcb6f0 _dispatch_call_block_and_release + 24
    10  libdispatch.dylib                   0x0000000101dccc74 _dispatch_client_callout + 16
    11  libdispatch.dylib                   0x0000000101dda6fc _dispatch_main_queue_callback_4CF + 1360
    12  CoreFoundation                      0x000000020adbac1c <redacted> + 12
    13  CoreFoundation                      0x000000020adb5b54 <redacted> + 1924
    14  CoreFoundation                      0x000000020adb50b0 CFRunLoopRunSpecific + 436
    15  Foundation                          0x000000020b782fac <redacted> + 300
    16  Foundation                          0x000000020b782e3c <redacted> + 96
    17  MyApp                      0x0000000100796c94 +[RNSplashScreen show] + 308
    18  MyApp                      0x00000001006e4d7c -[AppDelegate application:didFinishLaunchingWithOptions:] + 444
    19  UIKitCore                           0x00000002375dbe30 <redacted> + 412
    20  UIKitCore                           0x00000002375dd594 <redacted> + 3352
    21  UIKitCore                           0x00000002375e2d20 <redacted> + 1540
    22  UIKitCore                           0x0000000236ea62dc <redacted> + 776
    23  UIKitCore                           0x0000000236eae874 <redacted> + 160
    24  UIKitCore                           0x0000000236ea5f60 <redacted> + 236
    25  UIKitCore                           0x0000000236ea6850 <redacted> + 1064
    26  UIKitCore                           0x0000000236ea4b9c <redacted> + 744
    27  UIKitCore                           0x0000000236ea4864 <redacted> + 428
    28  UIKitCore                           0x0000000236ea93a4 <redacted> + 220
    29  UIKitCore                           0x0000000236eaa188 _performActionsWithDelayForTransitionContext + 112
    30  UIKitCore                           0x0000000236ea925c <redacted> + 244
    31  UIKitCore                           0x0000000236eadf5c <redacted> + 360
    32  UIKitCore                           0x00000002375e1328 <redacted> + 540
    33  UIKitCore                           0x00000002371ddba8 <redacted> + 360
    34  FrontBoardServices                  0x000000020d7a49fc <redacted> + 440
    35  FrontBoardServices                  0x000000020d7ae40c <redacted> + 256
    36  FrontBoardServices                  0x000000020d7adc14 <redacted> + 64
    37  libdispatch.dylib                   0x0000000101dccc74 _dispatch_client_callout + 16
    38  libdispatch.dylib                   0x0000000101dd0840 _dispatch_block_invoke_direct + 232
    39  FrontBoardServices                  0x000000020d7df040 <redacted> + 40
    40  FrontBoardServices                  0x000000020d7decdc <redacted> + 408
    41  FrontBoardServices                  0x000000020d7df294 <redacted> + 52
    42  CoreFoundation                      0x000000020adbb018 <redacted> + 24
    43  CoreFoundation                      0x000000020adbaf98 <redacted> + 88
    44  CoreFoundation                      0x000000020adba880 <redacted> + 176
    45  CoreFoundation                      0x000000020adb57bc <redacted> + 1004
    46  CoreFoundation                      0x000000020adb50b0 CFRunLoopRunSpecific + 436
    47  GraphicsServices                    0x000000020cfb579c GSEventRunModal + 104
    48  UIKitCore                           0x00000002375e4978 UIApplicationMain + 212
    49  MyApp                      0x00000001006e551c main + 124
    50  libdyld.dylib                       0x000000020a87a8e0 <redacted> + 4
)
2019-10-11 09:52:43.038945+0200 MyApp[309:11033] Exception '*** -[__NSArrayM objectAtIndexedSubscript:]: index 1 beyond bounds [0 .. 0]' was thrown while invoking getInitialNotification on target PushNotificationManager with params (
    148,
    149
)
callstack: (
    0   CoreFoundation                      0x000000020ae29294 <redacted> + 252
    1   libobjc.A.dylib                     0x000000020a0039f8 objc_exception_throw + 56
    2   CoreFoundation                      0x000000020ada2ce8 _CFArgv + 0
    3   CoreFoundation                      0x000000020ad27cfc <redacted> + 0
    4   MyApp                      0x000000010084dfac -[RCTModuleMethod processMethodSignature] + 10144
    5   MyApp                      0x00000001008526d4 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 164
    6   MyApp                      0x00000001008e488c _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 660
    7   MyApp                      0x00000001008e4400 _ZZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEiENK3$_0clEv + 144
    8   MyApp                      0x00000001008e4364 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 28
    9   libdispatch.dylib                   0x0000000101dcb6f0 _dispatch_call_block_and_release + 24
    10  libdispatch.dylib                   0x0000000101dccc74 _dispatch_client_callout + 16
    11  libdispatch.dylib                   0x0000000101dda6fc _dispatch_main_queue_callback_4CF + 1360
    12  CoreFoundation                      0x000000020adbac1c <redacted> + 12
    13  CoreFoundation                      0x000000020adb5b54 <redacted> + 1924
    14  CoreFoundation                      0x000000020adb50b0 CFRunLoopRunSpecific + 436
    15  Foundation                          0x000000020b782fac <redacted> + 300
    16  Foundation                          0x000000020b782e3c <redacted> + 96
    17  MyApp                      0x0000000100796c94 +[RNSplashScreen show] + 308
    18  MyApp                      0x00000001006e4d7c -[AppDelegate application:didFinishLaunchingWithOptions:] + 444
    19  UIKitCore                           0x00000002375dbe30 <redacted> + 412
    20  UIKitCore                           0x00000002375dd594 <redacted> + 3352
    21  UIKitCore                           0x00000002375e2d20 <redacted> + 1540
    22  UIKitCore                           0x0000000236ea62dc <redacted> + 776
    23  UIKitCore                           0x0000000236eae874 <redacted> + 160
    24  UIKitCore                           0x0000000236ea5f60 <redacted> + 236
    25  UIKitCore                           0x0000000236ea6850 <redacted> + 1064
    26  UIKitCore                           0x0000000236ea4b9c <redacted> + 744
    27  UIKitCore                           0x0000000236ea4864 <redacted> + 428
    28  UIKitCore                           0x0000000236ea93a4 <redacted> + 220
    29  UIKitCore                           0x0000000236eaa188 _performActionsWithDelayForTransitionContext + 112
    30  UIKitCore                           0x0000000236ea925c <redacted> + 244
    31  UIKitCore                           0x0000000236eadf5c <redacted> + 360
    32  UIKitCore                           0x00000002375e1328 <redacted> + 540
    33  UIKitCore                           0x00000002371ddba8 <redacted> + 360
    34  FrontBoardServices                  0x000000020d7a49fc <redacted> + 440
    35  FrontBoardServices                  0x000000020d7ae40c <redacted> + 256
    36  FrontBoardServices                  0x000000020d7adc14 <redacted> + 64
    37  libdispatch.dylib                   0x0000000101dccc74 _dispatch_client_callout + 16
    38  libdispatch.dylib                   0x0000000101dd0840 _dispatch_block_invoke_direct + 232
    39  FrontBoardServices                  0x000000020d7df040 <redacted> + 40
    40  FrontBoardServices                  0x000000020d7decdc <redacted> + 408
    41  FrontBoardServices                  0x000000020d7df294 <redacted> + 52
    42  CoreFoundation                      0x000000020adbb018 <redacted> + 24
    43  CoreFoundation                      0x000000020adbaf98 <redacted> + 88
    44  CoreFoundation                      0x000000020adba880 <redacted> + 176
    45  CoreFoundation                      0x000000020adb57bc <redacted> + 1004
    46  CoreFoundation                      0x000000020adb50b0 CFRunLoopRunSpecific + 436
    47  GraphicsServices                    0x000000020cfb579c GSEventRunModal + 104
    48  UIKitCore                           0x00000002375e4978 UIApplicationMain + 212
    49  MyApp                      0x00000001006e551c main + 124
    50  libdyld.dylib                       0x000000020a87a8e0 <redacted> + 4
)

这个项目是 运行 RN 0.59.5,我现在不能更新到 0.61...

要解决此问题,请在

中打开文件

yourproject/node_modules/react-native/React/Base/RCTModuleMethod.mm.

然后更正如下:

https://github.com/facebook/react-native/pull/25146/files#diff-263fc157dfce55895cdc16495b55d190