react-native-image-picker 사용시 다음과 같은 오류를 발생 할 경우가 있다.
=================================================================
Main Thread Checker: UI API called on a background thread: -[UIImagePickerController init]
PID: 9819, TID: 2519723, Thread name: (none), Queue name: com.facebook.react.ImagePickerManagerQueue, QoS: 0
Backtrace:
4 caudex 0x00000001017b0e58 -[ImagePickerManager launchImagePicker:] + 96
5 caudex 0x00000001017b0de0 -[ImagePickerManager launchImagePicker:options:] + 116
6 caudex 0x00000001017af27c -[ImagePickerManager launchImageLibrary:callback:] + 140
7 CoreFoundation 0x00000001b39b4c20 7519E999-1053-3367-B9D5-8844F6D3BDC6 + 1252384
8 CoreFoundation 0x00000001b3884d30 7519E999-1053-3367-B9D5-8844F6D3BDC6 + 7472
9 CoreFoundation 0x00000001b3885908 7519E999-1053-3367-B9D5-8844F6D3BDC6 + 10504
10 caudex 0x0000000101291ed0 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 1896
11 caudex 0x00000001012958cc _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 660
12 caudex 0x0000000101295440 _ZZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEiENK3$_0clEv + 144
13 caudex 0x00000001012953a4 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 28
14 libdispatch.dylib 0x0000000104cf97fc _dispatch_call_block_and_release + 24
15 libdispatch.dylib 0x0000000104cfabd8 _dispatch_client_callout + 16
16 libdispatch.dylib 0x0000000104d01b48 _dispatch_lane_serial_drain + 744
17 libdispatch.dylib 0x0000000104d026e4 _dispatch_lane_invoke + 448
18 libdispatch.dylib 0x0000000104d0dadc _dispatch_workloop_worker_thread + 1324
19 libsystem_pthread.dylib 0x00000001b36cab88 _pthread_wqthread + 276
20 libsystem_pthread.dylib 0x00000001b36cd760 start_wqthread + 8
2020-02-24 08:24:12.923320+0100 caudex[9819:2519723] [reports] Main Thread Checker: UI API called on a background thread: -[UIImagePickerController init]
PID: 9819, TID: 2519723, Thread name: (none), Queue name: com.facebook.react.ImagePickerManagerQueue, QoS: 0
Backtrace:
4 caudex 0x00000001017b0e58 -[ImagePickerManager launchImagePicker:] + 96
5 caudex 0x00000001017b0de0 -[ImagePickerManager launchImagePicker:options:] + 116
6 caudex 0x00000001017af27c -[ImagePickerManager launchImageLibrary:callback:] + 140
7 CoreFoundation 0x00000001b39b4c20 7519E999-1053-3367-B9D5-8844F6D3BDC6 + 1252384
8 CoreFoundation 0x00000001b3884d30 7519E999-1053-3367-B9D5-8844F6D3BDC6 + 7472
9 CoreFoundation 0x00000001b3885908 7519E999-1053-3367-B9D5-8844F6D3BDC6 + 10504
10 caudex 0x0000000101291ed0 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 1896
11 caudex 0x00000001012958cc _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 660
12 caudex 0x0000000101295440 _ZZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEiENK3$_0clEv + 144
13 caudex 0x00000001012953a4 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 28
14 libdispatch.dylib 0x0000000104cf97fc _dispatch_call_block_and_release + 24
15 libdispatch.dylib 0x0000000104cfabd8 _dispatch_client_callout + 16
16 libdispatch.dylib 0x0000000104d01b48 _dispatch_lane_serial_drain + 744
17 libdispatch.dylib 0x0000000104d026e4 _dispatch_lane_invoke + 448
18 libdispatch.dylib 0x0000000104d0dadc _dispatch_workloop_worker_thread + 1324
19 libsystem_pthread.dylib 0x00000001b36cab88 _pthread_wqthread + 276
20 libsystem_pthread.dylib 0x00000001b36cd760 start_wqthread + 8
facebook에서 아직 패치를 하지 않은 듯 하다.
이럴땐 ImagePickerManager.m를 다음과 같이 수정하면 해결 된다.
- (void)launchImagePicker:(RNImagePickerTarget)target options:(NSDictionary *)options
{
self.options = options;
dispatch_async(dispatch_get_main_queue(), ^(void) {
[self launchImagePicker:target];
});
}
'Developments > React Native' 카테고리의 다른 글
iOS Multitask 뷰에서 셋팅한 앱 icon이 보이지 않을 때 (0) | 2020.04.16 |
---|---|
Splash screen 변경 (0) | 2020.04.16 |
7 duplicate symbols for architecture arm64 오류 발생시 (0) | 2020.03.06 |
React Native + Admob (0) | 2020.03.06 |
iOS13 + react-native-image-picker permission 오류 해결 (0) | 2019.11.15 |