Skip to content

Screen flashes white on function call, and "discovery" error #462

Description

@willnix86

#425
Bug Report

Problem

When I fire off the function to select an image from the camera roll, the device screen flashes white and pauses slightly before opening the camera roll.

The pause is less with each press, but the flashing white screen still occurs - judging by my console logs, whenever I fire off the getCamera function, the app is being re-initialized (see screenshot - 'Open DB' should only be happening on app init.

The camera roll does load, but when I select an image, I receive the following error:

[discovery] errors encountered while discovering extensions: Error Domain=PlugInKit Code=13 "query cancelled" UserInfo={NSLocalizedDescription=query cancelled}

Initially, I wasn't receiving a permissions request for the camera roll so I had to wrap the function in a cordova.diagnostic request function, so now I KNOW permission to access the camera roll is granted.

What is expected to happen?

The camera roll prompt loads without a visual error and I can access the picture in the functions success callback.

What does actually happen?

See problem above ^^^

Information

Happens on both emulated and physical devices

Screen Shot 2019-06-15 at 8 34 51 PM

Command or Code

handleCameraRollPermission is fired from an onClick event

function handleCameraRollPermission() {
  window.cordova.plugins.diagnostic.getCameraRollAuthorizationStatus(status => {
    switch (status) {
      case window.cordova.plugins.diagnostic.permissionStatus.NOT_REQUESTED:
        window.cordova.plugins.diagnostic.requestCameraRollAuthorization(status => 
          status === window.cordova.plugins.diagnostic.permissionStatus.GRANTED &&
            addImage(), 
          err => console.log('Camera roll request error ' + err));
        break;
      case window.cordova.plugins.diagnostic.permissionStatus.DENIED:
          console.log("Permission denied");
          break;
      case window.cordova.plugins.diagnostic.permissionStatus.GRANTED:
          addImage();
          break;
      default:
        break;
    } 
  }, function(error){
      console.error("The following error occurred: "+error);
  });
}

function addImage() {
  navigator.camera.getPicture(imageURI => {
    console.log(imageURI);
  }, err => {
    console.log(err);
  }, {
    sourceType: window.Camera.PictureSourceType.PHOTOLIBRARY
  });
}

Environment, Platform, Device

Physical iPhone 6s - iOS 12.4
Simulated iPhone Xr - iOS 12.2

Version information

"cordova-android": "^8.0.0",
"cordova-android-firebase-gradle-release": "^3.0.0",
"cordova-android-play-services-gradle-release": "^3.0.0",
"cordova-browser": "^6.0.0",
"cordova-custom-config": "^5.1.0",
"cordova-ios": "^5.0.1",
"cordova-plugin-camera": "^4.0.3",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-whitelist": "^1.3.3",
"cordova-plugin-wkwebview-engine": "^1.1.4",
"cordova-sqlite-storage": "3.2.0",
"cordova.plugins.diagnostic": "4.0.12",
"react": "^16.8.6"

Xcode 10.2.1
Mac OS X Mojave

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions