cordova-plugin-camera icon indicating copy to clipboard operation
cordova-plugin-camera copied to clipboard

getPicture on ios15 does not return callback when selecting picture

Open martiin93 opened this issue 4 years ago • 3 comments

Bug Report

Problem

Using PICTURE_SOURCE_TYPE_SAVED_PHOTO_ALBUM as source on IOS 15 does not return any callback even though you have selected the image.

What is expected to happen?

The image url should be returned.

What does actually happen?

Nothing. The image selector is closed and no callback is triggered.

Information

Command or Code

 private void getImageFromSource() {
    final PhoneGap phoneGap = GWT.create(PhoneGap.class);
    PictureOptions options = new PictureOptions(100);
    options.setDestinationType(PictureOptions.DESTINATION_TYPE_FILE_URI);
    options.setEncoding(PictureOptions.CAMERA_ENCODING_TYPE_JPEG);
    int sourceType = imageSource == Source.CAMERA ? PictureOptions.PICTURE_SOURCE_TYPE_CAMERA
            : PictureOptions.PICTURE_SOURCE_TYPE_SAVED_PHOTO_ALBUM;
    options.setSourceType(sourceType);
    options.setQuality(IMAGE_QUALITY_SETTING);
    if (sourceType == PictureOptions.PICTURE_SOURCE_TYPE_CAMERA) {
        options.setAllowEdit(false);
    }
    phoneGap.getCamera().getPicture(options, new PictureCallback() {

        @Override
        public void onSuccess(String data) {
            display.setFilename(data);
            
            if (sourceType == PictureOptions.PICTURE_SOURCE_TYPE_SAVED_PHOTO_ALBUM
                    && phoneGap.getDevice().getPlatform().toLowerCase().equals("android")
                    && data.contains("content://")) {
                if (verifyFilepathPlugin()) {
                    resolvedNativePath = "";
                    resolveNativePath(data);
                }
            }

        }

        @Override
        public void onFailure(String message) {
            if (!message.equals("no image selected")) {
                StatusLogger.failedWhileImporting(CONST.image());
            }

        }
    });
}

Environment, Platform, Device

Phone: iPhone X OS: iOS 15.1

Version information

Cordova 10.0.0 cordova ios 6.2.0 cordova-plugin-camera 6.0.0 "Camera" cordova-plugin-file-opener2 2.0.19 "File Opener2" cordova-plugin-file-transfer 2.0.0-dev "File Transfer" cordova-plugin-file 6.0.2 "File" cordova-plugin-filepath 1.6.0 "cordova-plugin-filepath" cordova-plugin-wkwebview-file-xhr 3.0.0 "Cordova WKWebView File XHR Plugin" cordova-plugin-wkwebviewxhrfix 1.0.0 "Cordova WKWebView File XHR Fix"

Checklist

  • [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

martiin93 avatar Nov 16 '21 13:11 martiin93

same for me - when you set CameraUsesGeolocation to false in your config.xml it works - but that's not a solution, just a workaround

AdrianV avatar Nov 26 '21 12:11 AdrianV

same for me - when you set CameraUsesGeolocation to false in your config.xml it works - but that's not a solution, just a workaround

Thanks for the fix.

But is there a reason why CameraUsesGeolocation isn't working with the library?

mkattner avatar Jun 20 '22 19:06 mkattner

sorry I really don't remember, but it was something with a permission that the geolocation could not be extracted from the image or so.

AdrianV avatar Jun 22 '22 14:06 AdrianV