Нам нужно загрузить фотографии с камеры или библиотеки (фотогалереи) и загрузить их.В устройстве Android работает нормально, но iOS имеет следующую ошибку: TypeError: Object ( WEBPACK_IMPORTED_MODULE_1__ionic_native_core ["cordova"]) не является функцией.(В 'Object ( WEBPACK_IMPORTED_MODULE_1__ionic_native_core ["cordova"]) (this, "getPicture", {"callbackOrder": "reverse"}, аргументы)', 'Object ( WEBPACK_IMPORTED_MODULE_ion_core_core_core_1_core_1___"cordova"]) 'является экземпляром Object)
Также, для получения более подробной информации см. прикрепленный скриншот.
введите описание изображения здесь Код: if (sourceType =='библиотека') {
const Liboptions: CameraOptions = {
quality: 100,
destinationType: this.camera.DestinationType.FILE_URI,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.PICTURE,
sourceType:0,
saveToPhotoAlbum:true,
targetWidth:1024,
targetHeight:720,
allowEdit:true
}
this.camera.getPicture(Liboptions).then((imagePath) => {
// Special handling for Android library
var currentName = imagePath.substr(imagePath.lastIndexOf('/') + 1);
var correctPath = imagePath.substr(0, imagePath.lastIndexOf('/') + 1);
this.copyFileToLocalDir(correctPath, currentName, this.createFileName());
}, (err) => {
this.presentToast('Error while selecting image.');
});
} else {
const CamOptions: CameraOptions = {
quality: 100,
destinationType: this.camera.DestinationType.FILE_URI,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.PICTURE,
sourceType: this.camera.PictureSourceType.CAMERA,
targetWidth:1024,
targetHeight:720
}
//options.popoverOptions = CameraPopoverOption; options.correctOrientation = true;
this.camera.getPicture(CamOptions).then((imagePath) => {
// Special handling for Android library
var currentName = imagePath.substr(imagePath.lastIndexOf('/') + 1);
var correctPath = imagePath.substr(0, imagePath.lastIndexOf('/') + 1);
this.copyFileToLocalDir(correctPath, currentName, this.createFileName());
}, (err) => {
this.presentToast('Error while selecting image.');
});
}