birkir / react-native-carplay

CarPlay with React Native
https://birkir.dev/react-native-carplay/
MIT License
625 stars 103 forks source link

Crash when re-connecting to carplay #184

Open KestasVenslauskas opened 1 month ago

KestasVenslauskas commented 1 month ago

Describe the bug App crashes after re-connected to car play and pressing on any list item.

To Reproduce

  1. Display root template where it would have list template with some list items.
  2. Shut down car play emulator.
  3. Re-open car play simulator.
  4. Observe same template is shown.
  5. Press on any list item.
  6. App crashes

Expected behavior App should handle clicks as expected

Screenshots/Videos

https://github.com/birkir/react-native-carplay/assets/52245569/984de379-bd57-4322-b03e-91915a2399af

CarPlay (please complete the following information):

Additional context This bug was captured on production. Same behaviour can we observed with real device. My guess is that CarScene keeps a reference to an old template even if the app is trying to set new root template. This is a public project if you need to check any code.

Crashlytics info:

image
      Fatal Exception: NSInvalidArgumentException
0  CoreFoundation                 0x83f20 __exceptionPreprocess
1  libobjc.A.dylib                0x16018 objc_exception_throw
2  CoreFoundation                 0x15e6c -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]
3  CoreFoundation                 0x15a88 +[NSDictionary dictionaryWithObjects:forKeys:count:]
4  lrtApp                         0x9e0bf8 -[RNCarPlay listTemplate:didSelectListItem:completionHandler:] + 1273 (RNCarPlay.m:1273)
5  CarPlay                        0x1d3a0 __95-[CPListTemplate listTemplateWithIdentifier:didSelectListItemWithIdentifier:completionHandler:]_block_invoke
6  libdispatch.dylib              0x213c _dispatch_call_block_and_release
7  libdispatch.dylib              0x3dd4 _dispatch_client_callout
8  libdispatch.dylib              0x125a4 _dispatch_main_queue_drain
9  libdispatch.dylib              0x121b8 _dispatch_main_queue_callback_4CF
10 CoreFoundation                 0x56710 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
11 CoreFoundation                 0x53914 __CFRunLoopRun
12 CoreFoundation                 0x52cd8 CFRunLoopRunSpecific
13 GraphicsServices               0x11a8 GSEventRunModal
14 UIKitCore                      0x40a90c (Missing UUID 1741fa374e53371e8daed611aab0043d)
15 UIKitCore                      0x4be9d0 (Missing UUID 1741fa374e53371e8daed611aab0043d)
16 UIKitCore                      0x638384 (Missing UUID 1741fa374e53371e8daed611aab0043d)
17 lrtApp                         0x91ac main (AppDelegate.swift)
18 ???                            0x1c0151e4c (Missing)
KestasVenslauskas commented 1 month ago

Additional testing results that might be usefull. I observed this issue on 2.3.0 as well on 2.4.0-beta.2 But I also experience refreshing issue between those 2 versions.