2017-02-20 63 views
1

您好我創建一個離子框架的應用程序。我安裝了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中的功能。那之前我選擇了一張照片。爲什麼這個問題?在此先感謝

奇怪的是,直到不久前所有工作良好,我嘗試安裝此插件的舊版本,但錯誤是一樣的。可以與其他插件衝突?我也嘗試了角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" 
+0

解決了您的問題? –

回答

11

解決。我只是在config.xml文件中添加此首選項

<preference name="AndroidLaunchMode" value="standard"/> 
+0

它不在這裏工作! –

相關問題