所以我在我的项目中使用cordova-plugin-camera来制作照片并从图库中进行选择。Windows 10 Mobile - 应用程序在从图库中选择时崩溃
我的android-和iOS应用根本没有任何问题。但是当在现场Windows 10移动设备上进行测试时,我的应用程序在从我的图库中选择图像后崩溃。
虽然相机确实工作。
我使用的代码(简化)
this.camera.getPicture({
quality: 50,
destinationType: this.camera.DestinationType.FILE_URI,
sourceType: this.camera.PictureSourceType.PHOTOLIBRARY,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.PICTURE,
saveToPhotoAlbum: false, //gave problems in Windows
correctOrientation: true
}).then(imageURI => {
this.navCtrl.push(Page2, {image: imageURI});
}, err => {
// ionic alert, way of still showing alerts to Windows users
this.alertCtrl.create({message: err}).present();
});
而在第二页组件我有,什么被执行之前,通常会显示imageURI警报传递。
无论是成功还是错误回调都不会执行,应用程序只会关闭。
我试着在它周围加入一个try-catch,但它似乎不会引发错误。 (至少,抓不到它)。
你检查吗? https://github.com/apache/cordova-plugin-camera#windows-quirks –
@suraj是的,那是WP8和WP8.1。我已经找到了导致它的原因,并会在今天晚些时候写出一个答案。虽然Windows Universal所需的解决方法与WP8(.1)相同, – Ivaro18