Библиотека ионных фотографий не загружается в устройство iOS - PullRequest
0 голосов
/ 15 марта 2019

Нам нужно загрузить фотографии с камеры или библиотеки (фотогалереи) и загрузить их.В устройстве 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.');
      });
    }

1 Ответ

1 голос
/ 15 марта 2019

вам нужно добавить эту строку в ваш конфигурационный файл на платформе ios

<config-file parent="NSCameraUsageDescription" platform="ios" target="*-Info.plist">
 <string>You can take photos</string>
</config-file>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...