科尔多瓦相机插件。 “取消选择”错误 [英] cordova camera plugin. "selection cancelled" error
问题描述
我用离子框架创建一个应用程序。我安装了cordova-plugin-camera以通过我的设备选择和裁剪图像。但是当我尝试选择一个图像时,我总是收到错误选择取消
hi i create an app with the ionic framework. i installed the cordova-plugin-camera to select and crop a images by my device. but when i try to select an image i receive always the error "selection cancelled"
我的代码是这个
var options = {
quality: 100,
destinationType: Camera.DestinationType.DATA_URL,
sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
mediaType: Camera.MediaType.PICTURE,
allowEdit: true,
encodingType: Camera.EncodingType.JPEG,
targetWidth: 500,
targetHeight: 500,
popoverOptions: CameraPopoverOptions,
saveToPhotoAlbum: false,
correctOrientation: true
};
navigator.camera.getPicture(function (imageData) {
var temp = scope.avatar;
scope.avatar = "data:image/jpeg;base64," + imageData;
}, function (err) { alert(JSON.stringify(err)); }, options);
我在调用getPicture函数时立即收到错误。然后在那之前我选择一张照片。为什么这个问题?提前谢谢
i receive the error immediately when i call the getPicture function. then before that i select a photo. why this problem? thanks in advance
奇怪的是,直到前不久一切都运行良好,我尝试安装此插件的旧版本,但错误是一样的。可能与其他插件冲突?我也尝试了angular-js版本,但我有同样的错误
the strange thing is that until few time ago all work well, i try to install the old version of this plugin but the error is the same. can be a conflict with other plugins? i try also the angular-js version but i have the same error
我的插件列表是这个
cordova-plugin-admobpro 2.26.0 "AdMob Plugin Pro"
cordova-plugin-background-mode 0.7.2 "BackgroundMode"
cordova-plugin-camera 2.3.1 "Camera"
cordova-plugin-compat 1.1.0 "Compat"
cordova-plugin-console 1.0.5 "Console"
cordova-plugin-device 1.1.4 "Device"
cordova-plugin-extension 1.5.1 "Cordova Plugin Extension"
cordova-plugin-fcm 2.1.1 "FCMPlugin"
cordova-plugin-firebase 0.1.19 "Google Firebase Plugin"
cordova-plugin-statusbar 2.1.3 "StatusBar"
cordova-plugin-whitelist 1.2.2 "Whitelist"
ionic-plugin-keyboard 1.0.9 "Keyboard"
推荐答案
已解决。我只是在config.xml文件中添加此首选项
solved. i just add this preference in the config.xml file
<preference name="AndroidLaunchMode" value="standard"/>
这篇关于科尔多瓦相机插件。 “取消选择”错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!