iOS Crash in previewDocument() with React Native 0.84.1
Environment
- React:
19.2.3
- React Native:
0.84.1
- react-native-blob-util:
0.24.9
- Platform: iOS
Issue
Calling the following method:
RNFetchBlob.ios.previewDocument(filePath);
causes a Main Thread Checker crash/warning on iOS.
Error Logs
Main Thread Checker: UI API called on a background thread: -[UIApplication delegate]
Queue name: ReactNativeBlobUtil.queue
Backtrace:
-[ReactNativeBlobUtil presentOptionsMenu:scheme:resolve:reject:]
Additional Logs
Can't show source file for stack frame:
@objc AppDelegate.window.getter
The file path does not exist on the file system:
/<compiler-generated>
Full Logs
=================================================================
=================================================================
Main Thread Checker: UI API called on a background thread: -[UIApplication delegate]
PID: 57911, TID: 449216, Thread name: (none), Queue name: ReactNativeBlobUtil.queue, QoS: 0
Backtrace:
5 app 0x000000010384e548 -[ReactNativeBlobUtil presentOptionsMenu:scheme:resolve:reject:] + 448
6 CoreFoundation 0x00000001804c80c0 __invoking___ + 144
7 CoreFoundation 0x00000001804c5320 -[NSInvocation invoke] + 276
8 CoreFoundation 0x00000001804c55a4 -[NSInvocation invokeWithTarget:] + 60
9 React 0x000000010c68b49c ___ZN8facebook5react15ObjCTurboModule23performMethodInvocationERNS_3jsi7RuntimeEbPKcP12NSInvocationP14NSMutableArray_block_invoke + 196
10 React 0x000000010c6a1e8c _ZZN8facebook5react15ObjCTurboModule23performMethodInvocationERNS_3jsi7RuntimeEbPKcP12NSInvocationP14NSMutableArrayENK3$_1clEv + 116
11 React 0x000000010c6a1e0c _ZNSt3__18__invokeB8de190102IRZN8facebook5react15ObjCTurboModule23performMethodInvocationERNS1_3jsi7RuntimeEbPKcP12NSInvocationP14NSMutableArrayE3$_1JEEEDTclclsr3stdE7declvalIT_EEspclsr3stdE7declvalIT0_EEEEOSF_DpOSG_ + 24
12 React 0x000000010c6a1dc4 _ZNSt3__128__invoke_void_return_wrapperIvLb1EE6__callB8de190102IJRZN8facebook5react15ObjCTurboModule23performMethodInvocationERNS3_3jsi7RuntimeEbPKcP12NSInvocationP14NSMutableArrayE3$_1EEEvDpOT_ + 24
13 React 0x000000010c6a1da0 _ZNSt3__110__function12__alloc_funcIZN8facebook5react15ObjCTurboModule23performMethodInvocationERNS2_3jsi7RuntimeEbPKcP12NSInvocationP14NSMutableArrayE3$_1NS_9allocatorISE_EEFvvEEclB8de190102Ev + 28
14 React 0x000000010c6a0b1c _ZNSt3__110__function6__funcIZN8facebook5react15ObjCTurboModule23performMethodInvocationERNS2_3jsi7RuntimeEbPKcP12NSInvocationP14NSMutableArrayE3$_1NS_9allocatorISE_EEFvvEEclEv + 28
15 React 0x000000010c6b0108 _ZNKSt3__110__function12__value_funcIFvvEEclB8de190102Ev + 60
16 React 0x000000010c6afff8 _ZNKSt3__18functionIFvvEEclEv + 24
17 React 0x000000010c6b00c0 ___ZN12_GLOBAL__N_129ModuleNativeMethodCallInvoker11invokeAsyncERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEONS1_8functionIFvvEEE_block_invoke + 44
18 libdispatch.dylib 0x00000001080e3ee8 _dispatch_call_block_and_release + 24
19 libdispatch.dylib 0x00000001080fd374 _dispatch_client_callout + 12
20 libdispatch.dylib 0x00000001080ebfa4 _dispatch_lane_serial_drain + 888
21 libdispatch.dylib 0x00000001080ecc0c _dispatch_lane_invoke + 428
22 libdispatch.dylib 0x00000001080f8bf8 _dispatch_root_queue_drain_deferred_wlh + 324
23 libdispatch.dylib 0x00000001080f815c _dispatch_workloop_worker_thread + 752
24 libsystem_pthread.dylib 0x0000000107a1ec28 _pthread_wqthread + 288
25 libsystem_pthread.dylib 0x0000000107a1da28 start_wqthread + 8
Main Thread Checker: UI API called on a background thread: -[UIApplication delegate]
PID: 57911, TID: 449216, Thread name: (none), Queue name: ReactNativeBlobUtil.queue, QoS: 0
Backtrace:
5 app 0x000000010384e548 -[ReactNativeBlobUtil presentOptionsMenu:scheme:resolve:reject:] + 448
6 CoreFoundation 0x00000001804c80c0 __invoking___ + 144
7 CoreFoundation 0x00000001804c5320 -[NSInvocation invoke] + 276
8 CoreFoundation 0x00000001804c55a4 -[NSInvocation invokeWithTarget:] + 60
9 React 0x000000010c68b49c ___ZN8facebook5react15ObjCTurboModule23performMethodInvocationERNS_3jsi7RuntimeEbPKcP12NSInvocationP14NSMutableArray_block_invoke + 196
10 React 0x000000010c6a1e8c _ZZN8facebook5react15ObjCTurboModule23performMethodInvocationERNS_3jsi7RuntimeEbPKcP12NSInvocationP14NSMutableArrayENK3$_1clEv + 116
11 React 0x000000010c6a1e0c _ZNSt3__18__invokeB8de190102IRZN8facebook5react15ObjCTurboModule23performMethodInvocationERNS1_3jsi7RuntimeEbPKcP12NSInvocationP14NSMutableArrayE3$_1JEEEDTclclsr3stdE7declvalIT_EEspclsr3stdE7declvalIT0_EEEEOSF_DpOSG_ + 24
12 React 0x000000010c6a1dc4 _ZNSt3__128__invoke_void_return_wrapperIvLb1EE6__callB8de190102IJRZN8facebook5react15ObjCTurboModule23performMethodInvocationERNS3_3jsi7RuntimeEbPKcP12NSInvocationP14NSMutableArrayE3$_1EEEvDpOT_ + 24
13 React 0x000000010c6a1da0 _ZNSt3__110__function12__alloc_funcIZN8facebook5react15ObjCTurboModule23performMethodInvocationERNS2_3jsi7RuntimeEbPKcP12NSInvocationP14NSMutableArrayE3$_1NS_9allocatorISE_EEFvvEEclB8de190102Ev + 28
14 React 0x000000010c6a0b1c _ZNSt3__110__function6__funcIZN8facebook5react15ObjCTurboModule23performMethodInvocationERNS2_3jsi7RuntimeEbPKcP12NSInvocationP14NSMutableArrayE3$_1NS_9allocatorISE_EEFvvEEclEv + 28
15 React 0x000000010c6b0108 _ZNKSt3__110__function12__value_funcIFvvEEclB8de190102Ev + 60
16 React 0x000000010c6afff8 _ZNKSt3__18functionIFvvEEclEv + 24
17 React 0x000000010c6b00c0 ___ZN12_GLOBAL__N_129ModuleNativeMethodCallInvoker11invokeAsyncERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEONS1_8functionIFvvEEE_block_invoke + 44
18 libdispatch.dylib 0x00000001080e3ee8 _dispatch_call_block_and_release + 24
19 libdispatch.dylib 0x00000001080fd374 _dispatch_client_callout + 12
20 libdispatch.dylib 0x00000001080ebfa4 _dispatch_lane_serial_drain + 888
21 libdispatch.dylib 0x00000001080ecc0c _dispatch_lane_invoke + 428
22 libdispatch.dylib 0x00000001080f8bf8 _dispatch_root_queue_drain_deferred_wlh + 324
23 libdispatch.dylib 0x00000001080f815c _dispatch_workloop_worker_thread + 752
24 libsystem_pthread.dylib 0x0000000107a1ec28 _pthread_wqthread + 288
25 libsystem_pthread.dylib 0x0000000107a1da28 start_wqthread + 8
Can't show source file for stack frame 6: @objc AppDelegate.window.getter
The file path does not exist on the file system: /<compiler-generated>
Sample Code
RNFetchBlob.ios.previewDocument(filePath);
Expected Behavior
Document preview should open normally on iOS without Main Thread Checker warnings or crashes.
Actual Behavior
The app throws a Main Thread Checker warning/crash while opening the document preview.
Notes
- Issue is reproducible consistently on iOS.
- Happens with React Native
0.84.1.
- Appears related to TurboModules / New Architecture threading behavior.
- UIKit APIs may be invoked from a background thread (
ReactNativeBlobUtil.queue) instead of the main thread.
iOS Crash in
previewDocument()with React Native 0.84.1Environment
19.2.30.84.10.24.9Issue
Calling the following method:
causes a Main Thread Checker crash/warning on iOS.
Error Logs
Additional Logs
Full Logs
Sample Code
Expected Behavior
Document preview should open normally on iOS without Main Thread Checker warnings or crashes.
Actual Behavior
The app throws a Main Thread Checker warning/crash while opening the document preview.
Notes
0.84.1.ReactNativeBlobUtil.queue) instead of the main thread.