apache / apache/cordova-plugin-camera

getPicture on ios15 does not return callback when selecting picture

Open
#778 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
Objective-C
Stars
976
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

# 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.