Detox icon indicating copy to clipboard operation
Detox copied to clipboard

Crash on `+ [ReactNativeSupport reloadApp]` call with `[email protected]`

Open kkafar opened this issue 7 months ago • 12 comments

Did you test using the latest Detox?

  • [x] I have tested this issue on the latest Detox release and it still reproduces.

Did your test fail and you're not sure why?

  • [x] I have read the troubleshooting guide and it didn't help me.

What happened?

I'm updating react-native-screens example applications to use [email protected] & my e2e started to fail on calls to device.reloadReactNative(). See the logs below 👇🏻

Crash logs
  ● Simple Native Stack › should go back to main screen

    The pending request #-1000 ("reactNativeReload") has been rejected due to the following error:

    The app has crashed, see the details below:

    NSUnknownKeyException
    [<FabricExample.AppDelegate 0x600000c24ae0> valueForUndefinedKey:]: this class is not key value coding-compliant for the key rootViewFactory.
    (
    	0   CoreFoundation                      0x00000001804b9100 __exceptionPreprocess + 160
    	1   libobjc.A.dylib                     0x0000000180092da8 objc_exception_throw + 72
    	2   CoreFoundation                      0x00000001804b8ca0 -[NSException init] + 0
    	3   Foundation                          0x0000000180e9e8e0 -[NSObject(NSKeyValueCoding) valueForUndefinedKey:] + 188
    	4   Foundation                          0x0000000180e9d7c4 -[NSObject(NSKeyValueCoding) valueForKey:] + 260
    	5   Detox                               0x000000010102a478 +[ReactNativeSupport reloadApp] + 232
    	6   Detox                               0x0000000101078df4 merged reabstraction thunk helper from @escaping @callee_guaranteed () -> () to @escaping @callee_unowned @convention(block) () -> () + 28
    	7   DetoxSync                           0x0000000101d01e10 __36+[DTXSyncManager _tryIdleBlocksNow:]_block_invoke.66 + 172
    	8   libdispatch.dylib                   0x000000018017b314 _dispatch_call_block_and_release + 24
    	9   libdispatch.dylib                   0x000000018017cc08 _dispatch_client_callout + 16
    	10  libdispatch.dylib                   0x000000018018bc2c _dispatch_main_queue_drain + 1276
    	11  libdispatch.dylib                   0x000000018018b720 _dispatch_main_queue_callback_4CF + 40
    	12  CoreFoundation                      0x000000018041cdac __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
    	13  CoreFoundation                      0x0000000180417308 __CFRunLoopRun + 1944
    	14  CoreFoundation                      0x00000001804166f4 CFRunLoopRunSpecific + 552
    	15  GraphicsServices                    0x00000001905e5b10 GSEventRunModal + 160
    	16  UIKitCore                           0x0000000185b319dc -[UIApplication _run] + 796
    	17  DetoxSync                           0x0000000101cfd634 __detox_sync_UIApplication_run + 80
    	18  UIKitCore                           0x0000000185b35bd4 UIApplicationMain + 124
    	19  UIKitCore                           0x0000000184f0a334 block_destroy_helper.22 + 9660
    	20  FabricExample                       0x0000000100270ec4 main + 120
    	21  dyld                                0x00000001016cd410 start_sim + 20
    	22  ???                                 0x00000001011e2154 0x0 + 4313719124
    	23  ???                                 0xa235800000000000 0x0 + -6758354928311205888
    )

      3 | describe('Simple Native Stack', () => {
      4 |   beforeAll(async () => {
    > 5 |     await device.reloadReactNative();
        |                  ^
      6 |   });
      7 |
      8 |   it('should go to main screen', async () => {

      at Object.<anonymous> (e2e/examplesTests/simpleNativeStack.e2e.ts:5:18)

Test Suites: 11 failed, 11 total
Tests:       62 failed, 62 total
Snapshots:   0 total
Time:        413.107 s
Ran all test suites.
12:06:49.643 detox[41381] E Command failed with exit code = 1:
jest --config e2e/jest.config.js
Error: Process completed with exit code 1.

I realise that 0.79 is not yet officially supported, but keeping my fingers crossed that we'll be able to figure something out.

I believe the crash might be due to some recent changes (link) & changes to react native setup (link - look at changes to AppDelegate.swift)

What was the expected behaviour?

There should be no crash.

Help us reproduce this issue!

I do not have minimal reproduction, however the problem can be reproduced by:

  1. cloning react-native-screens repo
  2. preparing the repo by following setup instructions
  3. checkout to @kkafar/support-0.79.0-rc.4 branch
  4. yarn (at root level dir)
  5. cd FabricExample && yarn && cd ios && rbenv exec pod install && cd ../
  6. yarn build-e2e-ios && yarn test-e2e-ios

In what environment did this happen?

Detox version: 20.36.3 React Native version: 0.79.1 Has Fabric (React Native's new rendering system) enabled: yes Node version: 23.7.0 Device model: running on iPhone 16 Pro simulator iOS version: 18.4 macOS version: Sequoia 15.4 Xcode version: 16.3 Test-runner (select one): jest

Detox logs

Detox logs
[...]

14:32:01.220 detox[14773] B artifacts-manager onBeforeLaunchApp
  args: ({"bundleId":"org.reactjs.native.example.FabricExample","deviceId":"06C5AAB3-E775-4FF7-8BDA-943ECCBA36CF","launchArgs":{"detoxServer":"ws://localhost:55637","detoxSessionId":"515cbbb0-9d7e-c081-d807-3e9a761ad4ff"}})
14:32:01.220 detox[14773] E artifacts-manager onBeforeLaunchApp
14:32:01.220 detox[14773] i child-process:EXEC_CMD SIMCTL_CHILD_GULGeneratedClassDisposeDisabled=YES SIMCTL_CHILD_DYLD_INSERT_LIBRARIES="/Users/kkafara/Library/Detox/ios/framework/730e0bf26584b3207e04b56ca633d7be471ec36d/Detox.framework/Detox" /usr/bin/xcrun simctl launch 06C5AAB3-E775-4FF7-8BDA-943ECCBA36CF org.reactjs.native.example.FabricExample --args -detoxServer ws://localhost:55637 -detoxSessionId 515cbbb0-9d7e-c081-d807-3e9a761ad4ff -detoxDebugVisibility YES -detoxDisableHierarchyDump YES
14:32:01.221 detox[14773] i child-process:EXEC_TRY Launching org.reactjs.native.example.FabricExample...
14:32:01.392 detox[14773] i child-process:EXEC_SUCCESS org.reactjs.native.example.FabricExample: 14826

14:32:01.392 detox[14773] i child-process:EXEC_CMD /usr/bin/xcrun simctl get_app_container 06C5AAB3-E775-4FF7-8BDA-943ECCBA36CF org.reactjs.native.example.FabricExample
14:32:01.490 detox[14773] i child-process:EXEC_SUCCESS /Users/kkafara/Library/Developer/CoreSimulator/Devices/06C5AAB3-E775-4FF7-8BDA-943ECCBA36CF/data/Containers/Bundle/Application/3DCD6418-F929-4F52-8C17-9FBBC60D7166/FabricExample.app

14:32:01.496 detox[14773] i device org.reactjs.native.example.FabricExample launched. To watch simulator logs, run:
        /usr/bin/xcrun simctl spawn 06C5AAB3-E775-4FF7-8BDA-943ECCBA36CF log stream --level debug --style compact --predicate 'process == "FabricExample"'
14:32:01.496 detox[14773] B artifacts-manager onLaunchApp
  args: ({"bundleId":"org.reactjs.native.example.FabricExample","deviceId":"06C5AAB3-E775-4FF7-8BDA-943ECCBA36CF","launchArgs":{"detoxServer":"ws://localhost:55637","detoxSessionId":"515cbbb0-9d7e-c081-d807-3e9a761ad4ff","detoxDebugVisibility":"YES","detoxDisableHierarchyDump":"YES"},"pid":14826})
14:32:01.497 detox[14773] E artifacts-manager onLaunchApp

 RUNS  e2e/issuesTests/Test2809.e2e.ts
14:32:01.617 detox[14769] B ws-server@55643 connection :55637<->:55643
14:32:01.927 detox[14769] i ws-server@55643 get
  data: {"params":{"sessionId":"515cbbb0-9d7e-c081-d807-3e9a761ad4ff","role":"app"},"type":"login","messageId":0}
14:32:01.927 detox[14769] i ws-server@55643 send
  data: {
    "params": {
      "testerConnected": true,
      "appConnected": true
    },
    "type": "loginSuccess",
    "messageId": 0
  }
14:32:01.928 detox[14769] i ws-server app joined session 515cbbb0-9d7e-c081-d807-3e9a761ad4ff
14:32:01.929 detox[14769] i ws-server@55639 send
  data: {
14:32:01.929 detox[14773] i ws-client get message
  data: {"type":"appConnected"}
   
14:32:01.930 detox[14773] i ws-client send message
  data: {"type":"isReady","params":{},"messageId":-1000}

 RUNS  e2e/issuesTests/Test2809.e2e.ts
14:32:01.930 detox[14769] i ws-server@55639 get
  data: {"type":"isReady","params":{},"messageId":-1000}
14:32:01.931 detox[14769] i ws-server@55643 send
  data: {
    "type": "isReady",
    "params": {},
    "messageId": -1000
 RUNS  e2e/issuesTests/Test2809.e2e.ts
14:32:03.562 detox[14769] i ws-server@55643 get
  data: {"messageId":-1000,"type":"ready","params":{}}
14:32:03.562 detox[14769] i ws-server@55639 send
  data: {
    "messageId": -1000,
    "type": "ready",
    "params": {}
  }
14:32:03.563 detox[14773] i ws-client get message
  data: {"messageId":-1000,"type":"ready","params":{}}
   

 RUNS  e2e/issuesTests/Test2809.e2e.ts
14:32:03.563 detox[14769] i ws-server@55639 send
  data: {
    "messageId": -1000,
    "type": "ready",
    "params": {}
  }
14:32:03.564 detox[14769] i ws-server@55643 get
  data: {"messageId":-1000,"type":"ready","params":{}}
14:32:03.564 detox[14769] i ws-server@55639 send
  data: {
    "messageId": -1000,
    "type": "ready",
14:32:03.564 detox[14773] i ws-client send message
  data: {"type":"waitForActive","params":{},"messageId":1}
14:32:03.564 detox[14773] i ws-client get message
  data: {"messageId":-1000,"type":"ready","params":{}}
   

 RUNS  e2e/issuesTests/Test2809.e2e.ts
14:32:03.564 detox[14773] i ws-client get message
  data: {"messageId":-1000,"type":"ready","params":{}}
   

 RUNS  e2e/issuesTests/Test2809.e2e.ts
14:32:03.565 detox[14769] i ws-server@55643 send
  data: {
    "type": "waitForActive",
    "params": {},
    "messageId": 1
  }
14:32:03.568 detox[14769] i ws-server@55643 get
  data: {"messageId":1,"params":{},"type":"waitForActiveDone"}
14:32:03.569 detox[14769] i ws-server@55639 send
  data: {
    "messageId": 1,
    "params": {},
14:32:03.569 detox[14773] i ws-client get message
  data: {"messageId":1,"params":{},"type":"waitForActiveDone"}
   
14:32:03.569 detox[14773] B artifacts-manager onAppReady
  args: ({"deviceId":"06C5AAB3-E775-4FF7-8BDA-943ECCBA36CF","bundleId":"org.reactjs.native.example.FabricExample","pid":14826})
14:32:03.569 detox[14773] E artifacts-manager onAppReady
14:32:03.570 detox[14773] E device launchApp
14:32:03.570 detox[14773] E lifecycle beforeAll
14:32:03.570 detox[14773] B lifecycle Test2809
14:32:03.570 detox[14773] B artifacts-manager onRunDescribeStart
  args: ({"name":"Test2809"})
14:32:03.571 detox[14773] E artifacts-manager onRunDescribeStart
14:32:03.571 detox[14773] B lifecycle beforeAll
14:32:03.574 detox[14773] B device reloadReactNative
  args: ()
14:32:03.575 detox[14773] i ws-client send message
  data: {"type":"reactNativeReload","params":{},"messageId":-1000}

 RUNS  e2e/issuesTests/Test2809.e2e.ts
14:32:03.575 detox[14769] i ws-server@55639 get
  data: {"type":"reactNativeReload","params":{},"messageId":-1000}
14:32:03.576 detox[14769] i ws-server@55643 send
  data: {
    "type": "reactNativeReload",
    "params": {},
    "messageId": -1000
  }
14:32:03.586 detox[14769] i ws-server@55643 get
  data: {"params":{"threadNumber":1,"queueName":"com.apple.main-thread","errorDetails":"NSUnknownKeyException\n[<FabricExample.AppDelegate 0x600000c36d90> valueForUndefinedKey:]: this class is not key value coding-compliant for the key rootViewFactory.\n(\n\t0   CoreFoundation                      0x00000001804c88b4 __exceptionPreprocess + 160\n\t1   libobjc.A.dylib                     0x00000001800937cc objc_exception_throw + 72\n\t2   CoreFoundation                      0x00000001804c8454 -[NSException init] + 0\n\t3   Foundation                          0x0000000180ea05e0 -[NSObject(NSKeyValueCoding) valueForUndefinedKey:] + 188\n\t4   Foundation                          0x0000000180e9f4dc -[NSObject(NSKeyValueCoding) valueForKey:] + 260\n\t5   Detox                               0x0000000101e4e478 +[ReactNativeSupport reloadApp] + 232\n\t6   Detox                               0x0000000101e9cdf4 merged reabstraction thunk helper from @escaping @callee_guaranteed () -> () to @escaping @callee_unowned @convention(block) () -> () + 28\n\t7   DetoxSync                           0x0000000101c61e10 __36+[DTXSyncManager _tryIdleBlocksNow:]_block_invoke.66 + 172\n\t8   libdispatch.dylib                   0x000000018017c788 _dispatch_call_block_and_release + 24\n\t9   libdispatch.dylib                   0x0000000180197278 _dispatch_client_callout + 12\n\t10  libdispatch.dylib                   0x00000001801b2fcc _dispatch_main_queue_drain.cold.7 + 24\n\t11  libdispatch.dylib                   0x000000018018c1c4 _dispatch_main_queue_drain + 1184\n\t12  libdispatch.dylib                   0x000000018018bd14 _dispatch_main_queue_callback_4CF + 40\n\t13  CoreFoundation                      0x0000000180427fec __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12\n\t14  CoreFoundation                      0x00000001804229f8 __CFRunLoopRun + 1920\n\t15  CoreFoundation                      0x0000000180421e3c CFRunLoopRunSpecific + 536\n\t16  GraphicsServices                    0x0000000190f62d00 GSEventRunModal + 164\n\t17  UIKitCore                           0x0000000185bcec98 -[UIApplication _run] + 796\n\t18  DetoxSync                           0x0000000101c5d634 __detox_sync_UIApplication_run + 80\n\t19  UIKitCore                           0x0000000185bd3064 UIApplicationMain + 124\n\t20  UIKitCore                           0x0000000184f9ad6c block_destroy_helper.14 + 9560\n\t21  FabricExample                       0x0000000100a42df0 main + 120\n\t22  dyld                                0x0000000101a493d8 start_sim + 20\n\t23  ???                                 0x000000010191eb4c 0x0 + 4321307468\n)"},"messageId":-10000,"type":"AppWillTerminateWithError"}
14:32:03.586 detox[14769] i ws-server@55639 send
  data: {
    "params": {
      "threadNumber": 1,
      "queueName": "com.apple.main-thread",
      "errorDetails": "NSUnknownKeyException\n[<FabricExample.AppDelegate 0x600000c36d90> valueForUndefinedKey:]: this class is not key value coding-compliant for the key rootViewFactory.\n(\n\t0   CoreFoundation                      0x00000001804c88b4 __exceptionPreprocess + 160\n\t1   libobjc.A.dylib                     0x00000001800937cc objc_exception_throw + 72\n\t2   CoreFoundation                      0x00000001804c8454 -[NSException init] + 0\n\t3   Foundation                          0x0000000180ea05e0 -[NSObject(NSKeyValueCoding) valueForUndefinedKey:] + 188\n\t4   Foundation                          0x0000000180e9f4dc -[NSObject(NSKeyValueCoding) valueForKey:] + 260\n\t5   Detox                               0x0000000101e4e478 +[ReactNativeSupport reloadApp] + 232\n\t6   Detox                               0x0000000101e9cdf4 merged reabstraction thunk helper from @escaping @callee_guaranteed () -> () to @escaping @callee_unowned @convention(block) () -> () + 28\n\t7   DetoxSync                           0x0000000101c61e10 __36+[DTXSyncManager _tryIdleBlocksNow:]_block_invoke.66 + 172\n\t8   libdispatch.dylib                   0x000000018017c788 _dispatch_call_block_and_release + 24\n\t9   libdispatch.dylib                   0x0000000180197278 _dispatch_client_callout + 12\n\t10  libdispatch.dylib                   0x00000001801b2fcc _dispatch_main_queue_drain.cold.7 + 24\n\t11  libdispatch.dylib                   0x000000018018c1c4 _dispatch_main_queue_drain + 1184\n\t12  libdispatch.dylib                   0x000000018018bd14 _dispatch_main_queue_callback_4CF + 40\n\t13  CoreFoundation                      0x0000000180427fec __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12\n\t14  CoreFoundation                      0x00000001804229f8 __CFRunLoopRun + 1920\n\t15  CoreFoundation                      0x0000000180421e3c CFRunLoopRunSpecific + 536\n\t16  GraphicsServices                    0x0000000190f62d00 GSEventRunModal + 164\n\t17  UIKitCore                           0x0000000185bcec98 -[UIApplication _run] + 796\n\t18  DetoxSync                           0x0000000101c5d634 __detox_sync_UIApplication_run + 80\n\t19  UIKitCore                           0x0000000185bd3064 UIApplicationMain + 124\n\t20  UIKitCore                           0x0000000184f9ad6c block_destroy_helper.14 + 9560\n\t21  FabricExample                       0x0000000100a42df0 main + 120\n\t22  dyld                                0x0000000101a493d8 start_sim + 20\n\t23  ???                                 0x000000010191eb4c 0x0 + 4321307468\n)"
    },
    "messageId": -10000,
14:32:03.588 detox[14773] i ws-client get message
  data: {"params":{"threadNumber":1,"queueName":"com.apple.main-thread","errorDetails":"NSUnknownKeyException\n[<FabricExample.AppDelegate 0x600000c36d90> valueForUndefinedKey:]: this class is not key value coding-compliant for the key rootViewFactory.\n(\n\t0   CoreFoundation                      0x00000001804c88b4 __exceptionPreprocess + 160\n\t1   libobjc.A.dylib                     0x00000001800937cc objc_exception_throw + 72\n\t2   CoreFoundation                      0x00000001804c8454 -[NSException init] + 0\n\t3   Foundation                          0x0000000180ea05e0 -[NSObject(NSKeyValueCoding) valueForUndefinedKey:] + 188\n\t4   Foundation                          0x0000000180e9f4dc -[NSObject(NSKeyValueCoding) valueForKey:] + 260\n\t5   Detox                               0x0000000101e4e478 +[ReactNativeSupport reloadApp] + 232\n\t6   Detox                               0x0000000101e9cdf4 merged reabstraction thunk helper from @escaping @callee_guaranteed () -> () to @escaping @callee_unowned @convention(block) () -> () + 28\n\t7   DetoxSync                           0x0000000101c61e10 __36+[DTXSyncManager _tryIdleBlocksNow:]_block_invoke.66 + 172\n\t8   libdispatch.dylib                   0x000000018017c788 _dispatch_call_block_and_release + 24\n\t9   libdispatch.dylib                   0x0000000180197278 _dispatch_client_callout + 12\n\t10  libdispatch.dylib                   0x00000001801b2fcc _dispatch_main_queue_drain.cold.7 + 24\n\t11  libdispatch.dylib                   0x000000018018c1c4 _dispatch_main_queue_drain + 1184\n\t12  libdispatch.dylib                   0x000000018018bd14 _dispatch_main_queue_callback_4CF + 40\n\t13  CoreFoundation                      0x0000000180427fec __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12\n\t14  CoreFoundation                      0x00000001804229f8 __CFRunLoopRun + 1920\n\t15  CoreFoundation                      0x0000000180421e3c CFRunLoopRunSpecific + 536\n\t16  GraphicsServices                    0x0000000190f62d00 GSEventRunModal + 164\n\t17  UIKitCore                           0x0000000185bcec98 -[UIApplication _run] + 796\n\t18  DetoxSync                           0x0000000101c5d634 __detox_sync_UIApplication_run + 80\n\t19  UIKitCore                           0x0000000185bd3064 UIApplicationMain + 124\n\t20  UIKitCore                           0x0000000184f9ad6c block_destroy_helper.14 + 9560\n\t21  FabricExample                       0x0000000100a42df0 main + 120\n\t22  dyld                                0x0000000101a493d8 start_sim + 20\n\t23  ???                                 0x000000010191eb4c 0x0 + 4321307468\n)"},"messageId":-10000,"type":"AppWillTerminateWithError"}
   

 RUNS  e2e/issuesTests/Test2809.e2e.ts
14:32:05.595 detox[14769] i ws-server@55643 get
  data: {"messageId":-10000,"type":"AppWillTerminateWithError","params":{"threadNumber":1,"queueName":"com.apple.main-thread","errorDetails":"Signal 6 raised\n(\n\t0   Detox                               0x0000000101e5e514 +[NSThread(DetoxUtils) dtx_demangledCallStackSymbols] + 36\n\t1   Detox                               0x0000000101e614bc __DTXHandleCrash + 568\n\t2   Detox                               0x0000000101e61ac8 __DTXHandleSignal + 72\n\t3   libsystem_platform.dylib            0x00000001017eb640 _sigtramp + 52\n\t4   libsystem_pthread.dylib             0x000000010178e2ec pthread_kill + 264\n\t5   libsystem_c.dylib                   0x0000000180171ea8 abort + 100\n\t6   libc++abi.dylib                     0x00000001802b0144 __cxxabiv1::__aligned_malloc_with_fallback(unsigned long) + 0\n\t7   libc++abi.dylib                     0x000000018029fe4c demangling_terminate_handler() + 296\n\t8   libobjc.A.dylib                     0x000000018006f220 _objc_terminate() + 124\n\t9   Detox                               0x0000000101e61f8c __dtx_terminate() + 188\n\t10  libc++abi.dylib                     0x00000001802af570 std::__terminate(void (*)()) + 12\n\t11  libc++abi.dylib                     0x00000001802b2498 __cxa_get_exception_ptr + 0\n\t12  libc++abi.dylib                     0x00000001802b2478 __cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*) + 0\n\t13  libobjc.A.dylib                     0x0000000180093904 objc_exception_throw + 384\n\t14  CoreFoundation                      0x00000001804c8454 -[NSException init] + 0\n\t15  Foundation                          0x0000000180ea05e0 -[NSObject(NSKeyValueCoding) valueForUndefinedKey:] + 188\n\t16  Foundation                          0x0000000180e9f4dc -[NSObject(NSKeyValueCoding) valueForKey:] + 260\n\t17  Detox                               0x0000000101e4e478 +[ReactNativeSupport reloadApp] + 232\n\t18  Detox                               0x0000000101e9cdf4 merged reabstraction thunk helper from @escaping @callee_guaranteed () -> () to @escaping @callee_unowned @convention(block) () -> () + 28\n\t19  DetoxSync                           0x0000000101c61e10 __36+[DTXSyncManager _tryIdleBlocksNow:]_block_invoke.66 + 172\n\t20  libdispatch.dylib                   0x000000018017c788 _dispatch_call_block_and_release + 24\n\t21  libdispatch.dylib                   0x0000000180197278 _dispatch_client_callout + 12\n\t22  libdispatch.dylib                   0x00000001801b2fcc _dispatch_main_queue_drain.cold.7 + 24\n\t23  libdispatch.dylib                   0x000000018018c1c4 _dispatch_main_queue_drain + 1184\n\t24  libdispatch.dylib                   0x000000018018bd14 _dispatch_main_queue_callback_4CF + 40\n\t25  CoreFoundation                      0x0000000180427fec __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12\n\t26  CoreFoundation                      0x00000001804229f8 __CFRunLoopRun + 1920\n\t27  CoreFoundation                      0x0000000180421e3c CFRunLoopRunSpecific + 536\n\t28  GraphicsServices                    0x0000000190f62d00 GSEventRunModal + 164\n\t29  UIKitCore                           0x0000000185bcec98 -[UIApplication _run] + 796\n\t30  DetoxSync                           0x0000000101c5d634 __detox_sync_UIApplication_run + 80\n\t31  UIKitCore                           0x0000000185bd3064 UIApplicationMain + 124\n\t32  UIKitCore                           0x0000000184f9ad6c block_destroy_helper.14 + 9560\n\t33  FabricExample                       0x0000000100a42df0 main + 120\n\t34  dyld                                0x0000000101a493d8 start_sim + 20\n\t35  ???                                 0x000000010191eb4c 0x0 + 4321307468\n)"}}
14:32:05.595 detox[14769] i ws-server@55639 send
  data: {
    "messageId": -10000,
    "type": "AppWillTerminateWithError",
    "params": {
      "threadNumber": 1,
      "queueName": "com.apple.main-thread",
      "errorDetails": "Signal 6 raised\n(\n\t0   Detox                               0x0000000101e5e514 +[NSThread(DetoxUtils) dtx_demangledCallStackSymbols] + 36\n\t1   Detox                               0x0000000101e614bc __DTXHandleCrash + 568\n\t2   Detox                               0x0000000101e61ac8 __DTXHandleSignal + 72\n\t3   libsystem_platform.dylib            0x00000001017eb640 _sigtramp + 52\n\t4   libsystem_pthread.dylib             0x000000010178e2ec pthread_kill + 264\n\t5   libsystem_c.dylib                   0x0000000180171ea8 abort + 100\n\t6   libc++abi.dylib                     0x00000001802b0144 __cxxabiv1::__aligned_malloc_with_fallback(unsigned long) + 0\n\t7   libc++abi.dylib                     0x000000018029fe4c demangling_terminate_handler() + 296\n\t8   libobjc.A.dylib                     0x000000018006f220 _objc_terminate() + 124\n\t9   Detox                               0x0000000101e61f8c __dtx_terminate() + 188\n\t10  libc++abi.dylib                     0x00000001802af570 std::__terminate(void (*)()) + 12\n\t11  libc++abi.dylib                     0x00000001802b2498 __cxa_get_exception_ptr + 0\n\t12  libc++abi.dylib                     0x00000001802b2478 __cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*) + 0\n\t13  libobjc.A.dylib                     0x0000000180093904 objc_exception_throw + 384\n\t14  CoreFoundation                      0x00000001804c8454 -[NSException init] + 0\n\t15  Foundation                          0x0000000180ea05e0 -[NSObject(NSKeyValueCoding) valueForUndefinedKey:] + 188\n\t16  Foundation                          0x0000000180e9f4dc -[NSObject(NSKeyValueCoding) valueForKey:] + 260\n\t17  Detox                               0x0000000101e4e478 +[ReactNativeSupport reloadApp] + 232\n\t18  Detox                               0x0000000101e9cdf4 merged reabstraction thunk helper from @escaping @callee_guaranteed () -> () to @escaping @callee_unowned @convention(block) () -> () + 28\n\t19  DetoxSync                           0x0000000101c61e10 __36+[DTXSyncManager _tryIdleBlocksNow:]_block_invoke.66 + 172\n\t20  libdispatch.dylib                   0x000000018017c788 _dispatch_call_block_and_release + 24\n\t21  libdispatch.dylib                   0x0000000180197278 _dispatch_client_callout + 12\n\t22  libdispatch.dylib                   0x00000001801b2fcc _dispatch_main_queue_drain.cold.7 + 24\n\t23  libdispatch.dylib                   0x000000018018c1c4 _dispatch_main_queue_drain + 1184\n\t24  libdispatch.dylib                   0x000000018018bd14 _dispatch_main_queue_callback_4CF + 40\n\t25  CoreFoundation                      0x0000000180427fec __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12\n\t26  CoreFoundation                      0x00000001804229f8 __CFRunLoopRun + 1920\n\t27  CoreFoundation                      0x0000000180421e3c CFRunLoopRunSpecific + 536\n\t28  GraphicsServices                    0x0000000190f62d00 GSEventRunModal + 164\n\t29  UIKitCore                           0x0000000185bcec98 -[UIApplication _run] + 796\n\t30  DetoxSync                           0x0000000101c5d634 __detox_sync_UIApplication_run + 80\n\t31  UIKitCore                           0x0000000185bd3064 UIApplicationMain + 124\n\t32  UIKitCore                           0x0000000184f9ad6c block_destroy_helper.14 + 9560\n\t33  FabricExample                       0x0000000100a42df0 main + 120\n\t34  dyld                                0x0000000101a493d8 start_sim + 20\n\t35  ???                                 0x000000010191eb4c 0x0 + 4321307468\n)"
14:32:05.597 detox[14773] i ws-client get message
  data: {"messageId":-10000,"type":"AppWillTerminateWithError","params":{"threadNumber":1,"queueName":"com.apple.main-thread","errorDetails":"Signal 6 raised\n(\n\t0   Detox                               0x0000000101e5e514 +[NSThread(DetoxUtils) dtx_demangledCallStackSymbols] + 36\n\t1   Detox                               0x0000000101e614bc __DTXHandleCrash + 568\n\t2   Detox                               0x0000000101e61ac8 __DTXHandleSignal + 72\n\t3   libsystem_platform.dylib            0x00000001017eb640 _sigtramp + 52\n\t4   libsystem_pthread.dylib             0x000000010178e2ec pthread_kill + 264\n\t5   libsystem_c.dylib                   0x0000000180171ea8 abort + 100\n\t6   libc++abi.dylib                     0x00000001802b0144 __cxxabiv1::__aligned_malloc_with_fallback(unsigned long) + 0\n\t7   libc++abi.dylib                     0x000000018029fe4c demangling_terminate_handler() + 296\n\t8   libobjc.A.dylib                     0x000000018006f220 _objc_terminate() + 124\n\t9   Detox                               0x0000000101e61f8c __dtx_terminate() + 188\n\t10  libc++abi.dylib                     0x00000001802af570 std::__terminate(void (*)()) + 12\n\t11  libc++abi.dylib                     0x00000001802b2498 __cxa_get_exception_ptr + 0\n\t12  libc++abi.dylib                     0x00000001802b2478 __cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*) + 0\n\t13  libobjc.A.dylib                     0x0000000180093904 objc_exception_throw + 384\n\t14  CoreFoundation                      0x00000001804c8454 -[NSException init] + 0\n\t15  Foundation                          0x0000000180ea05e0 -[NSObject(NSKeyValueCoding) valueForUndefinedKey:] + 188\n\t16  Foundation                          0x0000000180e9f4dc -[NSObject(NSKeyValueCoding) valueForKey:] + 260\n\t17  Detox                               0x0000000101e4e478 +[ReactNativeSupport reloadApp] + 232\n\t18  Detox                               0x0000000101e9cdf4 merged reabstraction thunk helper from @escaping @callee_guaranteed () -> () to @escaping @callee_unowned @convention(block) () -> () + 28\n\t19  DetoxSync                           0x0000000101c61e10 __36+[DTXSyncManager _tryIdleBlocksNow:]_block_invoke.66 + 172\n\t20  libdispatch.dylib                   0x000000018017c788 _dispatch_call_block_and_release + 24\n\t21  libdispatch.dylib                   0x0000000180197278 _dispatch_client_callout + 12\n\t22  libdispatch.dylib                   0x00000001801b2fcc _dispatch_main_queue_drain.cold.7 + 24\n\t23  libdispatch.dylib                   0x000000018018c1c4 _dispatch_main_queue_drain + 1184\n\t24  libdispatch.dylib                   0x000000018018bd14 _dispatch_main_queue_callback_4CF + 40\n\t25  CoreFoundation                      0x0000000180427fec __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12\n\t26  CoreFoundation                      0x00000001804229f8 __CFRunLoopRun + 1920\n\t27  CoreFoundation                      0x0000000180421e3c CFRunLoopRunSpecific + 536\n\t28  GraphicsServices                    0x0000000190f62d00 GSEventRunModal + 164\n\t29  UIKitCore                           0x0000000185bcec98 -[UIApplication _run] + 796\n\t30  DetoxSync                           0x0000000101c5d634 __detox_sync_UIApplication_run + 80\n\t31  UIKitCore                           0x0000000185bd3064 UIApplicationMain + 124\n\t32  UIKitCore                           0x0000000184f9ad6c block_destroy_helper.14 + 9560\n\t33  FabricExample                       0x0000000100a42df0 main + 120\n\t34  dyld                                0x0000000101a493d8 start_sim + 20\n\t35  ???                                 0x000000010191eb4c 0x0 + 4321307468\n)"}}
   

 RUNS  e2e/issuesTests/Test2809.e2e.ts
14:32:07.614 detox[14769] i ws-server app exited session 515cbbb0-9d7e-c081-d807-3e9a761ad4ff
14:32:07.614 detox[14769] i ws-server@55639 send
  data: {
    "type": "appDisconnected"
14:32:07.615 detox[14773] i ws-client get message
  data: {"type":"appDisconnected"}
   
14:32:07.616 detox[14773] E device reloadReactNative
  error: The pending request #-1000 ("reactNativeReload") has been rejected due to the following error:
  
  The app has crashed, see the details below:
  
  NSUnknownKeyException
  [<FabricExample.AppDelegate 0x600000c36d90> valueForUndefinedKey:]: this class is not key value coding-compliant for the key rootViewFactory.
  (
  	0   CoreFoundation                      0x00000001804c88b4 __exceptionPreprocess + 160
  	1   libobjc.A.dylib                     0x00000001800937cc objc_exception_throw + 72
  	2   CoreFoundation                      0x00000001804c8454 -[NSException init] + 0
  	3   Foundation                          0x0000000180ea05e0 -[NSObject(NSKeyValueCoding) valueForUndefinedKey:] + 188
  	4   Foundation                          0x0000000180e9f4dc -[NSObject(NSKeyValueCoding) valueForKey:] + 260
  	5   Detox                               0x0000000101e4e478 +[ReactNativeSupport reloadApp] + 232
  	6   Detox                               0x0000000101e9cdf4 merged reabstraction thunk helper from @escaping @callee_guaranteed () -> () to @escaping @callee_unowned @convention(block) () -> () + 28
  	7   DetoxSync                           0x0000000101c61e10 __36+[DTXSyncManager _tryIdleBlocksNow:]_block_invoke.66 + 172
  	8   libdispatch.dylib                   0x000000018017c788 _dispatch_call_block_and_release + 24
  	9   libdispatch.dylib                   0x0000000180197278 _dispatch_client_callout + 12
  	10  libdispatch.dylib                   0x00000001801b2fcc _dispatch_main_queue_drain.cold.7 + 24
  	11  libdispatch.dylib                   0x000000018018c1c4 _dispatch_main_queue_drain + 1184
  	12  libdispatch.dylib                   0x000000018018bd14 _dispatch_main_queue_callback_4CF + 40
  	13  CoreFoundation                      0x0000000180427fec __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
  	14  CoreFoundation                      0x00000001804229f8 __CFRunLoopRun + 1920
  	15  CoreFoundation                      0x0000000180421e3c CFRunLoopRunSpecific + 536
  	16  GraphicsServices                    0x0000000190f62d00 GSEventRunModal + 164
  	17  UIKitCore                           0x0000000185bcec98 -[UIApplication _run] + 796
  	18  DetoxSync                           0x0000000101c5d634 __detox_sync_UIApplication_run + 80
  	19  UIKitCore                           0x0000000185bd3064 UIApplicationMain + 124
  	20  UIKitCore                           0x0000000184f9ad6c block_destroy_helper.14 + 9560
  	21  FabricExample                       0x0000000100a42df0 main + 120
  	22  dyld                                0x0000000101a493d8 start_sim + 20
  	23  ???                                 0x000000010191eb4c 0x0 + 4321307468
  )
14:32:07.617 detox[14773] B artifacts-manager onHookFailure
  args: ({"error":{"name":"DetoxRuntimeError"},"hook":"beforeAll"})
14:32:07.618 detox[14773] i artifact:ARTIFACT_START starting SimulatorScreenshot
14:32:07.619 detox[14773] i child-process:EXEC_CMD /usr/bin/xcrun simctl io 06C5AAB3-E775-4FF7-8BDA-943ECCBA36CF screenshot "/private/var/folders/r4/dg2fjxdd1qqb0r1hfhv1krnr0000gn/T/ff6ee6ca-4f37-42d6-a2a6-7ab08878f162.detox.png"
14:32:07.856 detox[14773] i child-process:EXEC_SUCCESS Detected file type 'PNG' from extension
Wrote screenshot to: /private/var/folders/r4/dg2fjxdd1qqb0r1hfhv1krnr0000gn/T/ff6ee6ca-4f37-42d6-a2a6-7ab08878f162.detox.png

14:32:07.856 detox[14773] i artifact:ARTIFACT_STOP stopping SimulatorScreenshot
14:32:07.856 detox[14773] E artifacts-manager onHookFailure
14:32:07.856 detox[14773] E lifecycle beforeAll
  error: The pending request #-1000 ("reactNativeReload") has been rejected due to the following error:
  
  The app has crashed, see the details below:
  
  NSUnknownKeyException
  [<FabricExample.AppDelegate 0x600000c36d90> valueForUndefinedKey:]: this class is not key value coding-compliant for the key rootViewFactory.
  (
  	0   CoreFoundation                      0x00000001804c88b4 __exceptionPreprocess + 160
  	1   libobjc.A.dylib                     0x00000001800937cc objc_exception_throw + 72
  	2   CoreFoundation                      0x00000001804c8454 -[NSException init] + 0
  	3   Foundation                          0x0000000180ea05e0 -[NSObject(NSKeyValueCoding) valueForUndefinedKey:] + 188
  	4   Foundation                          0x0000000180e9f4dc -[NSObject(NSKeyValueCoding) valueForKey:] + 260
  	5   Detox                               0x0000000101e4e478 +[ReactNativeSupport reloadApp] + 232
  	6   Detox                               0x0000000101e9cdf4 merged reabstraction thunk helper from @escaping @callee_guaranteed () -> () to @escaping @callee_unowned @convention(block) () -> () + 28
  	7   DetoxSync                           0x0000000101c61e10 __36+[DTXSyncManager _tryIdleBlocksNow:]_block_invoke.66 + 172
  	8   libdispatch.dylib                   0x000000018017c788 _dispatch_call_block_and_release + 24
  	9   libdispatch.dylib                   0x0000000180197278 _dispatch_client_callout + 12
  	10  libdispatch.dylib                   0x00000001801b2fcc _dispatch_main_queue_drain.cold.7 + 24
  	11  libdispatch.dylib                   0x000000018018c1c4 _dispatch_main_queue_drain + 1184
  	12  libdispatch.dylib                   0x000000018018bd14 _dispatch_main_queue_callback_4CF + 40
  	13  CoreFoundation                      0x0000000180427fec __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
  	14  CoreFoundation                      0x00000001804229f8 __CFRunLoopRun + 1920
  	15  CoreFoundation                      0x0000000180421e3c CFRunLoopRunSpecific + 536
  	16  GraphicsServices                    0x0000000190f62d00 GSEventRunModal + 164
  	17  UIKitCore                           0x0000000185bcec98 -[UIApplication _run] + 796
  	18  DetoxSync                           0x0000000101c5d634 __detox_sync_UIApplication_run + 80
  	19  UIKitCore                           0x0000000185bd3064 UIApplicationMain + 124
  	20  UIKitCore                           0x0000000184f9ad6c block_destroy_helper.14 + 9560
  	21  FabricExample                       0x0000000100a42df0 main + 120
  	22  dyld                                0x0000000101a493d8 start_sim + 20
  	23  ???                                 0x000000010191eb4c 0x0 + 4321307468
  )
14:32:07.857 detox[14773] B lifecycle Test2809 should exist
14:32:07.857 detox[14773] i lifecycle Test2809: Test2809 should exist
14:32:07.858 detox[14773] E lifecycle Test2809 should exist
14:32:07.858 detox[14773] i lifecycle Test2809: Test2809 should exist [FAIL]
[...]

Device logs

Failed to produce requested file.

Device logs
paste your device.log here!

More data, please!

I believe the most important part of the stack trace is here

● Test2809 › Custom back label should be truncated to minimal by backButtonDisplayMode when title is long

    The pending request #-1000 ("reactNativeReload") has been rejected due to the following error:

    The app has crashed, see the details below:

    NSUnknownKeyException
    [<FabricExample.AppDelegate 0x600000c34330> valueForUndefinedKey:]: this class is not key value coding-compliant for the key rootViewFactory.
    (
    	0   CoreFoundation                      0x00000001804c88b4 __exceptionPreprocess + 160
    	1   libobjc.A.dylib                     0x00000001800937cc objc_exception_throw + 72
    	2   CoreFoundation                      0x00000001804c8454 -[NSException init] + 0
    	3   Foundation                          0x0000000180ea05e0 -[NSObject(NSKeyValueCoding) valueForUndefinedKey:] + 188
    	4   Foundation                          0x0000000180e9f4dc -[NSObject(NSKeyValueCoding) valueForKey:] + 260
    	5   Detox                               0x0000000103f8a478 +[ReactNativeSupport reloadApp] + 232
    	6   Detox                               0x0000000103fd8df4 merged reabstraction thunk helper from @escaping @callee_guaranteed () -> () to @escaping @callee_unowned @convention(block) () -> () + 28
    	7   DetoxSync                           0x0000000103a11e10 __36+[DTXSyncManager _tryIdleBlocksNow:]_block_invoke.66 + 172
    	8   libdispatch.dylib                   0x000000018017c788 _dispatch_call_block_and_release + 24
    	9   libdispatch.dylib                   0x0000000180197278 _dispatch_client_callout + 12
    	10  libdispatch.dylib                   0x00000001801b2fcc _dispatch_main_queue_drain.cold.7 + 24
    	11  libdispatch.dylib                   0x000000018018c1c4 _dispatch_main_queue_drain + 1184
    	12  libdispatch.dylib                   0x000000018018bd14 _dispatch_main_queue_callback_4CF + 40
    	13  CoreFoundation                      0x0000000180427fec __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
    	14  CoreFoundation                      0x00000001804229f8 __CFRunLoopRun + 1920
    	15  CoreFoundation                      0x0000000180421e3c CFRunLoopRunSpecific + 536
    	16  GraphicsServices                    0x0000000190f62d00 GSEventRunModal + 164
    	17  UIKitCore                           0x0000000185bcec98 -[UIApplication _run] + 796
    	18  DetoxSync                           0x0000000103a0d634 __detox_sync_UIApplication_run + 80
    	19  UIKitCore                           0x0000000185bd3064 UIApplicationMain + 124
    	20  UIKitCore                           0x0000000184f9ad6c block_destroy_helper.14 + 9560
    	21  FabricExample                       0x0000000102acadf0 main + 120
    	22  dyld                                0x00000001039493d8 start_sim + 20
    	23  ???                                 0x0000000103b12b4c 0x0 + 4356909900
    )

kkafar avatar Apr 16 '25 12:04 kkafar

I believe the problem lies exactly here:

https://github.com/wix/Detox/blob/1ead1eebcfdae16167a6af6aa5b9ebed3f3ecb20/detox/ios/Detox/Utilities/ReactNativeSupport/ReactNativeSupport.m#L44-L46

Since 0.79.0 the AppDelegate does no longer extend RCTApplicationDelegate therefore there is no rootViewFactory field present on the delegate.

kkafar avatar Apr 16 '25 13:04 kkafar

I believe you can now get the rootViewFactory from AppDelegate through AppDelegate.reactNativeFactory; however I dunno yet whether the reload code will work fine or not.

kkafar avatar Apr 16 '25 13:04 kkafar

Hi @kkafar detox supports react native up to 0.77. We are working to add support to 0.78 and 0.79 ASAP

gosha212 avatar Apr 28 '25 11:04 gosha212

That's great news. I hope you find my above ☝ investigation helpful.

kkafar avatar May 09 '25 09:05 kkafar

We use Detox for FlashList's e2e test too. Looking forward to 0.79 support.

naqvitalha avatar May 14 '25 18:05 naqvitalha

Hello @gosha212, any ETA to support 0.78 and 0.79

dhairyasenjaliya avatar May 19 '25 07:05 dhairyasenjaliya

Looking forward for the support for RN 0.79...

zhouzh1 avatar May 22 '25 02:05 zhouzh1

Yeah, bumping here with question whether we have any progress in this matter? We have RN 0.80 coming in a week or so :/

kkafar avatar Jun 02 '25 14:06 kkafar

@kkafar we are 100% capacity working on the upgrades

gosha212 avatar Jun 03 '25 10:06 gosha212

Thank you!

kkafar avatar Jun 03 '25 21:06 kkafar

Let's see when there is support for 0.79.0 main issues are on Android, should we use Android 35 emulators?

fjmorant avatar Jun 10 '25 16:06 fjmorant

@fjmorant you can use Emulator API 35 before moving to RN 0.79.0. Detox supports it

gosha212 avatar Jun 11 '25 07:06 gosha212

@kkafar we are 100% capacity working on the upgrades

Any news on an estimated release date?

angelica-snowit avatar Jun 19 '25 07:06 angelica-snowit

latest release Detox 20.40.0 is still crashing on RN 0.79

tomrn1 avatar Jul 07 '25 10:07 tomrn1

@tomrn1 We're supporting 0.78. I'm currently working on 0.79 and 0.80 right now

gosha212 avatar Jul 08 '25 11:07 gosha212

You can follow the progress here: https://github.com/wix/Detox/pull/4800

gosha212 avatar Jul 10 '25 07:07 gosha212

Are there any estimates on releasing support for 0.79, we cannot run tests

tomrn1 avatar Jul 23 '25 07:07 tomrn1

Hi @tomrn1 https://github.com/wix/Detox/pull/4800 it should work on rn 79. However we still can't release the version because of some backward compatibility issues. It should be ready in a few days / weeks

gosha212 avatar Jul 23 '25 07:07 gosha212

Hi @tomrn1 #4800 it should work on rn 79. However we still can't release the version because of some backward compatibility issues. It should be ready in a few days / weeks

Sorry, indeed it is working. Thank you!

tomrn1 avatar Jul 23 '25 10:07 tomrn1

fixed by #4799

gosha212 avatar Aug 31 '25 10:08 gosha212

@gosha212, I'm still running into this issue with latest detox on ios.

Detox version: 20.41.1 RN: 0.79.2

error: `The pending request #-1000 ("reactNativeReload") has been rejected due to the following error:

The app has crashed, see the details below:

Invalid AppDelegate
Could not access rootViewFactory. Make sure your AppDelegate either: Inherits from RCTAppDelegate Or defines 'reactNativeFactory'
(
	0   CoreFoundation                      0x00000001804c97c8 __exceptionPreprocess + 160
	1   libobjc.A.dylib                     0x00000001800937cc objc_exception_throw + 72
	2   CoreFoundation                      0x00000001804c96e4 -[NSException initWithCoder:] + 0
	3   Detox                               0x0000000104d15c20 +[ReactNativeSupport getReactHost] + 384
	4   Detox                               0x0000000104d15988 +[ReactNativeSupport reloadApp] + 172
	5   Detox                               0x0000000104d64b74 merged reabstraction thunk helper from @escaping @callee_guaranteed () -> () to @escaping @callee_unowned @convention(block) () -> () + 28
	6   DetoxSync                           0x0000000104b89e10 __36+[DTXSyncManager _tryIdleBlocksNow:]_block_invoke.66 + 172
	7   libdispatch.dylib                   0x000000018017c788 _dispatch_call_block_and_release + 24
	8   libdispatch.dylib                   0x0000000180197278 _dispatch_client_callout + 12
	9   libdispatch.dylib                   0x00000001801b300c _dispatch_main_queue_drain.cold.7 + 24
	10  libdispatch.dylib                   0x000000018018c1c4 _dispatch_main_queue_drain + 1184
	11  libdispatch.dylib                   0x000000018018bd14 _dispatch_main_queue_callback_4CF + 40
	12  CoreFoundation                      0x0000000180428e9c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
	13  CoreFoundation                      0x00000001804238a8 __CFRunLoopRun + 1920
	14  CoreFoundation                      0x0000000180422cec CFRunLoopRunSpecific + 536
	15  GraphicsServices                    0x0000000191004d00 GSEventRunModal + 164
	16  UIKitCore                           0x0000000185c597d4 -[UIApplication _run] + 796
	17  DetoxSync                           0x0000000104b85634 __detox_sync_UIApplication_run + 80
	18  UIKitCore                           0x0000000185c5dba0 UIApplicationMain + 124
	19  UIKitCore                           0x0000000185023f1c block_destroy_helper.14 + 9560
	20  Momence.debug.dylib                 0x0000000115a99664 static (extension in UIKit):__C.UIApplicationDelegate.main() -> () + 128
	21  Momence.debug.dylib                 0x0000000115a995d4 static Momence.AppDelegate.$main() -> () + 44
	22  Momence.debug.dylib                 0x0000000115a9a198 __debug_main_executable_dylib_entry_point + 28
	23  dyld                                0x00000001047a53d4 start_sim + 20
	24  ???                                 0x000000010489eb98 0x0 + 4371114904
)`

N0x1k avatar Sep 12 '25 07:09 N0x1k

Make sure you build the app and run rebuild-framework-cache

gosha212 avatar Sep 14 '25 14:09 gosha212

I've rebuilt all but I have the same error:

RN 0.79.5 Detox 20.41.1

 The app has crashed, see the details below:

    Invalid AppDelegate
    Could not access rootViewFactory. Make sure your AppDelegate either: Inherits from RCTAppDelegate Or defines 'reactNativeFactory'

angelica-snowit avatar Sep 15 '25 07:09 angelica-snowit

@angelica-snowit can you share you app delegate please? Did you follow the upgrade instructions of react? Does it work without detox?

gosha212 avatar Sep 15 '25 12:09 gosha212

@angelica-snowit can you share you app delegate please? Did you follow the upgrade instructions of react? Does it work without detox?

Yes, the app works fine, I'm having problem just with detox.

This is the content of the AppDelegate.swift file

import UIKit
import React
import React_RCTAppDelegate
import ReactAppDependencyProvider

// CUSTOM CHANGE from react-native-firebase/app@22
import Firebase

// CUSTOM CHANGE from react-native-bootsplash@6
import RNBootSplash

// CUSTOM CHANGE from react-native-fbsdk-next@13
import UIKit
import FBSDKCoreKit

// CUSTOM CHANGE react-native-maps
import GoogleMaps

// CUSTOM CHANGE react-native-notifications
import RNNotifications

@main
class AppDelegate: UIResponder, UIApplicationDelegate {
  var window: UIWindow?

  var reactNativeDelegate: ReactNativeDelegate?
  var reactNativeFactory: RCTReactNativeFactory?

  func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
  ) -> Bool {
    // CUSTOM CHANGE from react-native-firebase/app@22
    FirebaseApp.configure()

    // CUSTOM CHANGE react-native-maps
    GMSServices.provideAPIKey("AIzaSyDYpj_XR5An7O3ZYg8B0-wRe7pEvxJc2Lo")

    let delegate = ReactNativeDelegate()
    let factory = RCTReactNativeFactory(delegate: delegate)
    delegate.dependencyProvider = RCTAppDependencyProvider()

    reactNativeDelegate = delegate
    reactNativeFactory = factory

    window = UIWindow(frame: UIScreen.main.bounds)

    let moduleName = Bundle.main.object(forInfoDictionaryKey: "CFBundleName") as? String ?? "Snowit"

    factory.startReactNative(
      withModuleName: moduleName,
      in: window,
      launchOptions: launchOptions
    )

    // CUSTOM CHANGE from react-native-fbsdk-next@13
    ApplicationDelegate.shared.application(
        application,
        didFinishLaunchingWithOptions: launchOptions
    )

    // CUSTOM CHANGE react-native-notifications
    RNNotifications.startMonitorNotifications()

    return true
  }

  // CUSTOM CHANGE from react-native-fbsdk-next@13
  func application(
      _ app: UIApplication,
      open url: URL,
      options: [UIApplication.OpenURLOptionsKey : Any] = [:]
  ) -> Bool {
      ApplicationDelegate.shared.application(
          app,
          open: url,
          sourceApplication: options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String,
          annotation: options[UIApplication.OpenURLOptionsKey.annotation]
      )

      // CUSTOM CHANGE react-native-navigations
      // Deep links (schema://)
      return RCTLinkingManager.application(app, open: url, options: options)
  }


  // CUSTOM CHANGE react-native-navigations
  // Universal links (https://url)
  func application(
    _ application: UIApplication,
    continue userActivity: NSUserActivity,
    restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
      return RCTLinkingManager.application(
        application,
        continue: userActivity,
        restorationHandler: restorationHandler
      )
    }

  // CUSTOM CHANGE react-native-notifications
  func application(
    _ application: UIApplication,
    didRegisterForRemoteNotificationsWithDeviceToken withDeviceToken: Data) {
      RNNotifications.didRegisterForRemoteNotifications(withDeviceToken: withDeviceToken)
   }

  func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
      RNNotifications.didFailToRegisterForRemoteNotificationsWithError(error)
  }

  func application(
    _ application: UIApplication,
    didReceiveRemoteNotification userInfo: [AnyHashable: Any],
    fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
      RNNotifications.didReceiveBackgroundNotification(userInfo, withCompletionHandler: completionHandler)
  }

}

class ReactNativeDelegate: RCTDefaultReactNativeFactoryDelegate {
  override func sourceURL(for bridge: RCTBridge) -> URL? {
    self.bundleURL()
  }

  // CUSTOM CHANGE from react-native-bootsplash@6
  override func customize(_ rootView: RCTRootView) {
    super.customize(rootView)
    RNBootSplash.initWithStoryboard(Bundle.main.object(forInfoDictionaryKey: "UILaunchStoryboardName") as? String ?? "BootSplash", rootView: rootView) // ⬅️ initialize the splash screen
  }

  override func bundleURL() -> URL? {
#if DEBUG
    RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
#else
    Bundle.main.url(forResource: "main", withExtension: "jsbundle")
#endif
  }

}

angelica-snowit avatar Sep 15 '25 12:09 angelica-snowit

@angelica-snowit it looks fine. Can we get a side project that reproduces the issue?

gosha212 avatar Sep 15 '25 13:09 gosha212

Why is this one closed? It's still relevant.

mduchev avatar Sep 18 '25 16:09 mduchev

It would be very appreciated if someone started looking at this issue, we currently have to use launchApp() instead of the reloadReactNative() which slows down our tests.

N0x1k avatar Sep 19 '25 09:09 N0x1k

@angelica-snowit it looks fine. Can we get a side project that reproduces the issue?

Here it is: https://github.com/angelica-snowit/detox-reload-app

anija avatar Sep 19 '25 10:09 anija

Any update on this? @gosha212

N0x1k avatar Sep 23 '25 07:09 N0x1k