[英]cordova camera plugin. “selection cancelled” error
嗨,我創建與離子框架的應用程序。 我安裝了cordova-plugin-camera以通過我的設備選擇和裁剪圖像。 但是當我嘗試選擇圖像時,總是收到錯誤消息“選擇取消”
我的代碼是這樣
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函數時,我立即收到錯誤。 然后在那之前我選擇一張照片。 為什么會有這個問題? 提前致謝
奇怪的是,直到幾天前一切正常,我嘗試安裝此插件的舊版本,但錯誤是相同的。 可能與其他插件發生沖突? 我也嘗試了angular-js版本,但是我有同樣的錯誤
我的插件列表是這個
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文件中添加此首選項
<preference name="AndroidLaunchMode" value="standard"/>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.