【发布时间】:2018-01-04 16:11:39
【问题描述】:
所以我在我的项目中使用了cordova-plugin-camera 来制作照片并从图库中选择。
我的安卓和 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();
});
在 Page2 组件中,在执行任何操作之前,我有一个警报,通常会显示已通过的 imageURI。
成功和错误回调都没有执行,应用程序只是关闭。
我尝试在它周围添加一个 try-catch,但它似乎不会引发错误。 (至少,catch 没有抓住它。)
【问题讨论】:
-
@suraj 是的,这适用于 WP8 和 WP8.1。我已经找到了导致它的原因,并将在今天晚些时候写一个答案。尽管 Windows Universal 所需的解决方法与 WP8(.1) 相同,但问题不同
标签: windows cordova ionic2 win-universal-app windows-10-universal