tinycreative / react-native-intercom

React Native wrapper for Intercom.io
MIT License
406 stars 280 forks source link

Fix UI API called on a background thread on iOS #409

Closed gotvitch closed 3 years ago

gotvitch commented 3 years ago

When opening the messenger on iOS, it take few seconds to open and the following error is logged several time. This seems to have been introduce with this commit: https://github.com/tinycreative/react-native-intercom/commit/d1655faafde23e646a91592cff56fdefbe6e33dc

Main Thread Checker: UI API called on a background thread: -[UIApplication windows]
PID: 6662, TID: 3056615, Thread name: (none), Queue name: com.facebook.react.IntercomWrapperQueue, QoS: 0
Backtrace:
4   TestApp                            0x0000000100e81868 RCTKeyWindow + 116
5   TestApp                            0x0000000100e81a60 RCTPresentedViewController + 104
6   TestApp                            0x0000000101300b94 -[IntercomWrapper displayMessenger::] + 100
7   CoreFoundation                      0x00000001a82c75d4 52963DBA-FA89-36C2-8262-28B9776F8C12 + 1205716
8   CoreFoundation                      0x00000001a81a29e8 52963DBA-FA89-36C2-8262-28B9776F8C12 + 6632
9   CoreFoundation                      0x00000001a81a2fa4 52963DBA-FA89-36C2-8262-28B9776F8C12 + 8100
10  TestApp                            0x0000000100e13294 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 1880
11  TestApp                            0x0000000100e1695c _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 648
12  TestApp                            0x0000000100e16510 _ZZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEiENK3$_0clEv + 128
13  TestApp                            0x0000000100e16484 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 28
14  libdispatch.dylib                   0x0000000104137b68 _dispatch_call_block_and_release + 32
15  libdispatch.dylib                   0x00000001041395f0 _dispatch_client_callout + 20
16  libdispatch.dylib                   0x0000000104140fa8 _dispatch_lane_serial_drain + 736
17  libdispatch.dylib                   0x0000000104141cb4 _dispatch_lane_invoke + 448
18  libdispatch.dylib                   0x000000010414de38 _dispatch_workloop_worker_thread + 1520
19  libsystem_pthread.dylib             0x00000001f01b3908 _pthread_wqthread + 276
20  libsystem_pthread.dylib             0x00000001f01ba77c start_wqthread + 8
rsousabluebeck commented 3 years ago

When will this be merged in? It does fix the timing issue!

1awaleed commented 3 years ago

@albinekb when will this PR be merged?

BredoGen commented 3 years ago

Merging this will return the lib to an actual working state on iOS

mnsrv commented 3 years ago

Hello, I got the same issue on first launch. When this PR will be merged?

browniefed commented 3 years ago

react-native-intercom@20.1.0