react-native-clusterer icon indicating copy to clipboard operation
react-native-clusterer copied to clipboard

New Arch: insertReactSubview, object cannot be nil (iOS)

Open gunnartorfis opened this issue 1 year ago • 6 comments

I applied the patch provided in #45 and it built without issues. However, when using the clusterer, the app crashes when trying to add new views. This happens when I load more data into the clusterer (which happens on onRegionChange).

Let me know if I should instead file a bug report in react-native-maps.

expo: 52.0.0-preview.5 react-native: 0.76 react-native-maps: 1.18.2 react-native-clusterer: latest with the mentioned patch

Here's the full crash log:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
*** First throw call stack:
(
	0   CoreFoundation                      0x00000001804ae0f8 __exceptionPreprocess + 172
	1   libobjc.A.dylib                     0x0000000180087db4 objc_exception_throw + 56
	2   CoreFoundation                      0x0000000180393044 -[__NSArrayM insertObject:atIndex:] + 1252
	3   NoonaQA                             0x00000001049e7898 -[AIRMap insertReactSubview:atIndex:] + 884
	4   NoonaQA                             0x0000000103e81858 -[RCTLegacyViewManagerInteropComponentView finalizeUpdates:] + 1248
	5   NoonaQA                             0x0000000103e99098 _ZL27RCTPerformMountInstructionsRKNSt3__16vectorIN8facebook5react18ShadowViewMutationENS_9allocatorIS3_EEEEP24RCTComponentViewRegistryR41RCTMountingTransactionObserverCoordinatori + 2080
	6   NoonaQA                             0x0000000103e9886c _ZZ41-[RCTMountingManager performTransaction:]ENK3$_1clERKN8facebook5react19MountingTransactionERKNS1_16SurfaceTelemetryE + 80
	7   NoonaQA                             0x0000000103e98810 _ZNSt3__18__invokeB8ue170006IRZ41-[RCTMountingManager performTransaction:]E3$_1JRKN8facebook5react19MountingTransactionERKNS4_16SurfaceTelemetryEEEEDTclclsr3stdE7declvalIT_EEspclsr3stdE7declvalIT	8   NoonaQA                             0x0000000103e987b8 _ZNSt3__128__invoke_void_return_wrapperIvLb1EE6__callB8ue170006IJRZ41-[RCTMountingManager performTransaction:]E3$_1RKN8facebook5react19MountingTransactionERKNS6_16SurfaceTelemetryEEEEvDpOT_ + 40
	9   NoonaQA                             0x0000000103e98784 _ZNSt3__110__function12__alloc_funcIZ41-[RCTMountingManager performTransaction:]E3$_1NS_9allocatorIS2_EEFvRKN8facebook5react19MountingTransactionERKNS6_16SurfaceTelemetryEEEclB8ue170006ES9_SC_ + 	10  NoonaQA                             0x0000000103e975f0 _ZNSt3__110__function6__funcIZ41-[RCTMountingManager performTransaction:]E3$_1NS_9allocatorIS2_EEFvRKN8facebook5react19MountingTransactionERKNS6_16SurfaceTelemetryEEEclES9_SC_ + 44
	11  NoonaQA                             0x0000000103c84cb4 _ZNKSt3__110__function12__value_funcIFvRKN8facebook5react19MountingTransactionERKNS3_16SurfaceTelemetryEEEclB8ue170006ES6_S9_ + 84
	12  NoonaQA                             0x0000000103c83c90 _ZNKSt3__18functionIFvRKN8facebook5react19MountingTransactionERKNS2_16SurfaceTelemetryEEEclES5_S8_ + 40
	13  NoonaQA                             0x0000000103c83aec _ZNK8facebook5react19TelemetryController15pullTransactionERKNSt3__18functionIFvRKNS0_19MountingTransactionERKNS0_16SurfaceTelemetryEEEESD_SD_ + 300
	14  NoonaQA                             0x0000000103e92e00 -[RCTMountingManager performTransaction:] + 536
	15  NoonaQA                             0x0000000103e92b98 -[RCTMountingManager initiateTransaction:] + 428
	16  NoonaQA                             0x0000000103e92574 __42-[RCTMountingManager scheduleTransaction:]_block_invoke + 324
	17  NoonaQA                             0x0000000103ab2b68 __RCTExecuteOnMainQueue_block_invoke + 40
	18  libdispatch.dylib                   0x000000010afebec4 _dispatch_call_block_and_release + 24
	19  libdispatch.dylib                   0x000000010afed73c _dispatch_client_callout + 16
	20  libdispatch.dylib                   0x000000010affd3f8 _dispatch_main_queue_drain + 1228
	21  libdispatch.dylib                   0x000000010affcf1c _dispatch_main_queue_callback_4CF + 40
	22  CoreFoundation                      0x000000018040e960 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
	23  CoreFoundation                      0x0000000180409078 __CFRunLoopRun + 1936
	24  CoreFoundation                      0x00000001804084d4 CFRunLoopRunSpecific + 572
	25  GraphicsServices                    0x000000018ef2aae4 GSEventRunModal + 160
	26  UIKitCore                           0x00000001853d0a28 -[UIApplication _run] + 868
	27  UIKitCore                           0x00000001853d46b0 UIApplicationMain + 124
	28  NoonaQA                             0x0000000102a3635c main + 96
	29  dyld                                0x000000010af5d544 start_sim + 20
	30  ???                                 0x000000010b0de0e0 0x0 + 4480426208
	31  ???                                 0x6676800000000000 0x0 + 7383229376608862208
)
Stack Trace: (
    "0   CoreFoundation                      0x00000001804ae0f8 __exceptionPreprocess + 172",
    "1   libobjc.A.dylib                     0x0000000180087db4 objc_exception_throw + 56",
    "2   CoreFoundation                      0x0000000180393044 -[__NSArrayM insertObject:atIndex:] + 1252",
    "3   NoonaQA                             0x00000001049e7898 -[AIRMap insertReactSubview:atIndex:] + 884",
    "4   NoonaQA                             0x0000000103e81858 -[RCTLegacyViewManagerInteropComponentView finalizeUpdates:] + 1248",
    "5   NoonaQA                             0x0000000103e99098 _ZL27RCTPerformMountInstructionsRKNSt3__16vectorIN8facebook5react18ShadowViewMutationENS_9allocatorIS3_EEEEP24RCTComponentViewRegistryR41RCTMountingTransactionObserverCoordinatori + 2080",
    "6   NoonaQA                             0x0000000103e9886c _ZZ41-[RCTMountingManager performTransaction:]ENK3$_1clERKN8facebook5react19MountingTransactionERKNS1_16SurfaceTelemetryE + 80",
    "7   NoonaQA
libc++abi: terminating due to uncaught exception of type NSException

gunnartorfis avatar Oct 26 '24 11:10 gunnartorfis

This looks like a rendering issue within react-native-maps unless there is a problem with the data generated by react-native-clusterer.

JiriHoffmann avatar Oct 27 '24 22:10 JiriHoffmann

@JiriHoffmann thanks. How can I validate that there isn't a problem with the data generated by the clusterer?

gunnartorfis avatar Oct 28 '24 20:10 gunnartorfis

FWIW we have the same/similar issue after #45, but haven't had the time to debug it yet.

petetnt avatar Nov 06 '24 15:11 petetnt

It seems to come with the latest version of react-native I'm facing the same issue since the upgrade of react-native

"react-native-clusterer": "^3.0.0",
"react-native": "0.76.5",
"react-native-maps": "1.10.4",

nathanguigui avatar Dec 12 '24 11:12 nathanguigui

After investigation, the bug comes from react-native-maps The fix is mentioned in the tickets bellow https://github.com/react-native-maps/react-native-maps/issues/5217 https://github.com/react-native-maps/react-native-maps/pull/5226

nathanguigui avatar Dec 12 '24 13:12 nathanguigui

@JiriHoffmann the PRs mentioned have been merged a long time ago but the crash is still happening on latest react-native-maps + new architecture. Any ideas?

gunnartorfis avatar Jul 27 '25 22:07 gunnartorfis