Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getPicture on ios15 does not return callback when selecting picture #778

Open
3 tasks done
martiin93 opened this issue Nov 16, 2021 · 3 comments
Open
3 tasks done

Comments

@martiin93
Copy link

martiin93 commented Nov 16, 2021

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

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

AdrianV commented Nov 26, 2021

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

@mkattner
Copy link

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?

@AdrianV
Copy link

AdrianV commented Jun 22, 2022

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 added a commit to AdrianV/cordova-plugin-camera that referenced this issue Jun 21, 2023
setting data to nil in line 386 crashes the front end app. Therefore I commented it out.
This is not a perfect solution for the Issue apache#778 because we want the location data when `CameraUsesGeolocation`  but better not to crash.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants