cannerycoders opened a new issue #663:
URL: https://github.com/apache/cordova-plugin-camera/issues/663
# Bug Report
## Problem
When camera.getPicture is invoked, a long-ish delay (5 sec) occurs before
successfully
presenting the camera view. In the xcode console I see these messages:
```
020-09-20 10:42:22.828828-0700 myApp[1069:319363] [reports] Main Thread
Checker: UI API called on a background thread: -[UINavigationController
setDelegate:]
PID: 1069, TID: 319363, Thread name: (none), Queue name:
com.apple.root.default-qos, QoS: 0
Backtrace:
4 myApp 0x0000000100411804 -[CDVCamera
showCameraPicker:withOptions:] + 184
5 myApp 0x0000000100410e74 __25-[CDVCamera
takePicture:]_block_invoke_2 + 324
6 TCC 0x00000001cccb840c
503BE2BA-F75C-3D90-83A6-3A941D77C334 + 13324
7 TCC 0x00000001cccbc95c
503BE2BA-F75C-3D90-83A6-3A941D77C334 + 31068
8 libxpc.dylib 0x00000001d479d8ec
71E5302F-09BE-3116-8D43-EC2D4C27BE10 + 104684
9 libxpc.dylib 0x00000001d4791598
71E5302F-09BE-3116-8D43-EC2D4C27BE10 + 54680
10 libdispatch.dylib 0x000000010080d678
_dispatch_client_callout3 + 20
11 libdispatch.dylib 0x000000010082ab80
_dispatch_mach_msg_async_reply_invoke + 396
12 libdispatch.dylib 0x0000000100821270
_dispatch_kevent_worker_thread + 1416
13 libsystem_pthread.dylib 0x00000001d476c940 _pthread_wqthread
+ 332
14 libsystem_pthread.dylib 0x00000001d477377c start_wqthread + 8
2020-09-20 10:42:23.103711-0700 myApp[1069:319150] [Camera] Failed to read
exposureBiasesByMode dictionary: Error Domain=NSCocoaErrorDomain Code=4864 "***
-[NSKeyedUnarchiver _initForReadingFromData:error:throwLegacyExceptions:]: data
is NULL" UserInfo={NSDebugDescription=*** -[NSKeyedUnarchiver
_initForReadingFromData:error:throwLegacyExceptions:]: data is NULL}
2020-09-20 10:42:23.670110-0700 myApp[1069:319150] [Presentation] Attempt to
present <CDVCameraPicker: 0x10187d800> on <MainViewController: 0x100b0cf80>
(from <MainViewController: 0x100b0cf80>) whose view is not in the window
hierarchy.
2020-09-20 10:42:33.640598-0700 myApp[1069:319150] [Camera] Failed to read
exposureBiasesByMode dictionary: Error Domain=NSCocoaErrorDomain Code=4864 "***
-[NSKeyedUnarchiver _initForReadingFromData:error:throwLegacyExceptions:]: data
is NULL" UserInfo={NSDebugDescription=*** -[NSKeyedUnarchiver
_initForReadingFromData:error:throwLegacyExceptions:]: data is NULL}
```
### What is expected to happen?
Click a button to start the camera, within 1sec the camera appears.
In plugin version 4.1.1, there is no lag, and the message doesn't appear.
### What does actually happen?
Click a button to start the camera, 5 seconds go by, then the camera appears.
## Information
<!-- Include all relevant information that might help understand and
reproduce the problem -->
Here's my invocation:
navigator.camera.getPicture(onSuccess, onFail, getCamOpts());
here are the camera options i'm using:
```
{
quality: 95,
destinationType: Camera.DestinationType.FILE_URI,
sourceType: fromlib ? Camera.PictureSourceType.PHOTOLIBRARY :
Camera.PictureSourceType.CAMERA,
encodingType: Camera.EncodingType.JPEG,
mediaType: Camera.MediaType.PICTURE,
correctOrientation: true,
};
```
The stack reported above is associated with the sourceType of CAMERA
When sourceType is PHOTOLIBRARY, i also get a long delay and _several_ stack
traces like this:
```
Main Thread Checker: UI API called on a background thread:
-[UIImagePickerController init]
PID: 1104, TID: 326131, Thread name: (none), Queue name:
com.apple.root.default-qos, QoS: 0
Backtrace:
4 myApp 0x0000000100db7040 +[CDVCameraPicker
createFromPictureOptions:] + 112
5 myApp 0x0000000100db17c0 -[CDVCamera
showCameraPicker:withOptions:] + 116
6 myApp 0x0000000100db0cf4 __25-[CDVCamera
takePicture:]_block_invoke + 1024
```
### Command or Code
<!-- What command or code is needed to reproduce the problem? -->
navigator.camera.getPicture(onSuccess, onFail, getCamOpts()); // (above)
### Environment, Platform, Device
<!-- In what environment, on what platform or on which device are you
experiencing the issue? -->
IOS14 from macos catalina, xcode 12.0.0
### Version information
<!--
What are relevant versions you are using?
For example:
Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins
Other Frameworks: Ionic Framework and CLI version
Operating System, Android Studio, Xcode etc.
-->
IOS14 iPhone XR
cordova 10.0.0
cordova-plugin-camera: 5.0.0
cordova-ios: 6.1.1
xcode: 12.0.0
## Checklist
<!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
- [ x] I searched for existing GitHub issues
- [ x] I updated all Cordova tooling to most recent version
- [ x] I included all the necessary information above
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]