在我的离子应用程序中,我正在使用@ ionic-native / camera(版本4.5.2)中的Camera
我想让用户从图库中选择图片(JPG,PNG),所以我要这样做:
let options = {
maxImages: 1,
sourceType: this.camera.PictureSourceType.SAVEDPHOTOALBUM,
destinationType: this.camera.DestinationType.DATA_URL,
encodingType: this.camera.EncodingType.JPEG,
correctOrientation : true,
targetWidth : 600,
targetHeight : 600
};
this.camera.getPicture(options).then((imageData) => {
//code to upload picture
}, (error) => {
//code to handle error
}
当我选择有效图片时,此方法效果很好,但是随后创建了一个扩展名为.jpg的空文件,当我选择该应用程序时,该应用程序崩溃了,它从未到达“处理错误的代码”。
以下是有关ionic / cordova依赖性的一些信息:
"@ionic-native/android-fingerprint-auth": "^3.5.0",
"@ionic-native/camera": "^4.5.2",
"@ionic-native/core": "^3.6.1",
"@ionic-native/device": "^3.5.0",
"@ionic-native/diagnostic": "^3.6.1",
"@ionic-native/in-app-browser": "^3.10.3",
"@ionic-native/keyboard": "^3.10.3",
"@ionic-native/native-storage": "^3.5.0",
"@ionic-native/navigation-bar": "^3.5.0",
"@ionic-native/network": "^4.5.2",
"@ionic-native/photo-library": "^4.5.2",
"@ionic-native/social-sharing": "^4.5.2",
"@ionic-native/splash-screen": "3.4.2",
"@ionic-native/status-bar": "^3.4.2",
"@ionic-native/three-dee-touch": "^3.10.3",
"@ionic-native/touch-id": "^3.5.0",
"@ionic/storage": "2.0.1",
"cordova-android": "^6.2.2",
"cordova-ios": "^4.3.1",
"cordova-plugin-camera": "~2.4.1",
"cordova-plugin-console": "1.0.5",
"cordova-plugin-device": "1.1.4",
"cordova-plugin-ios-camera-permissions": "^1.2.0",
"cordova-plugin-photo-library": "2.1.1",
"cordova-plugin-splashscreen": "~4.0.1",
"cordova-plugin-statusbar": "^2.4.1",
"cordova-plugin-whitelist": "1.3.1",
"cordova-plugin-x-socialsharing": "~5.2.1",
"ionic-angular": "3.0.1",
"ionic-native": "https://github.com/ionic-team/ionic-native/tarball/v3.5.0",
"ionic-plugin-keyboard": "~2.2.1",
"ionicons": "3.0.0",
和devDependencies:
"@ionic/app-scripts": "^3.2.0",
"@ionic/cli-plugin-cordova": "1.6.2",
"@ionic/cli-plugin-ionic-angular": "1.4.1",
关于如何处理此错误的任何想法?让我知道是否需要其他信息