react-native-swift-socketio
react-native-swift-socketio copied to clipboard
Crashing on reload
I get this crash in XCode when trying to reload the simulator. After commenting things out down the line it appears to happen only when calling emit
. It seems like most of the stack runs through the Swift client code, so I'm not really sure if this is the right place for this issue.
2015-07-07 13:06:31.515 CuraMessenger[61768:4708747] *** Assertion failure in -[RCTBatchedBridge modules](), /Users/nic/work/CuraMessenger/node_modules/react-native/React/Base/RCTBridge.m:1085
2015-07-07 13:06:31.558 CuraMessenger[61768:4708747] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Bridge modules have not yet been initialized. You may be trying to access a module too early in the startup procedure.'
*** First throw call stack:
(
0 CoreFoundation 0x000000010c4fbc65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010b96bbb7 objc_exception_throw + 45
2 CoreFoundation 0x000000010c4fbaca +[NSException raise:format:arguments:] + 106
3 Foundation 0x000000010b580a57 -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 169
4 CuraMessenger 0x000000010b12826c -[RCTBatchedBridge modules] + 252
5 CuraMessenger 0x000000010b14d738 -[RCTBridge(RCTEventDispatcher) eventDispatcher] + 40
6 CuraMessenger 0x000000010b0ab600 _TFC13CuraMessenger8SocketIOP33_FC225C2DD54A6DEB206E1AA5A57BED5B17onAnyEventHandlerfS0_FCS_14SocketAnyEventT_ + 272
7 CuraMessenger 0x000000010b0921e7 _TTRXFo_oC13CuraMessenger14SocketAnyEvent_dT__XFo_iS0__iT__ + 23
8 CuraMessenger 0x000000010b08e9d1 _TPA__TTRXFo_oC13CuraMessenger14SocketAnyEvent_dT__XFo_iS0__iT__ + 81
9 CuraMessenger 0x000000010b091de0 _TTRXFo_iC13CuraMessenger14SocketAnyEvent_iT__XFo_oS0__dT__ + 32
10 CuraMessenger 0x000000010b091d74 _TFFC13CuraMessenger14SocketIOClient11handleEventFS0_FTSS4dataGSqGSaPSs9AnyObject___17isInternalMessageSb8wantsAckGSqSi__T_U_FT_T_ + 484
11 CuraMessenger 0x000000010b04ce37 _TTRXFo__dT__XFdCb__dT__ + 39
12 libdispatch.dylib 0x000000011009e186 _dispatch_call_block_and_release + 12
13 libdispatch.dylib 0x00000001100bd614 _dispatch_client_callout + 8
14 libdispatch.dylib 0x00000001100a5a1c _dispatch_main_queue_callback_4CF + 1664
15 CoreFoundation 0x000000010c4631f9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
16 CoreFoundation 0x000000010c424dcb __CFRunLoopRun + 2043
17 CoreFoundation 0x000000010c424366 CFRunLoopRunSpecific + 470
18 GraphicsServices 0x00000001107eba3e GSEventRunModal + 161
19 UIKit 0x000000010e2158c0 UIApplicationMain + 1282
20 CuraMessenger 0x000000010b04681f main + 111
21 libdyld.dylib 0x00000001100f1145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Spent a couple more days trying to figure this out. It seems to be a directly related to initializing the onAnyEvent
handler (and subsequently onAnyEventHandler
)
https://github.com/kirkness/react-native-swift-socketio/blob/master/RNSwiftSocketIO/Socket.swift#L85-L93
It crashes pretty reliably reloading the simulator, but I've also seen it crash intermittently on a device. I have no idea why that handler wouldn't work.
@nicinabox I'm having this exact same issue. Were you able to fix this by any chance?