无法在离子3

时间:2019-01-31 14:39:21

标签: ionic-framework cordova-plugins react-native-android

[在此处输入图片描述] [1]我在使用操作表打开相机并出现跟随错误时正在使用面对的问题。

  

CameraProxy.js:105未被捕获的TypeError:无法在“ URL”上执行“ createObjectURL”:未找到与提供的签名匹配的函数。       在successCallback(CameraProxy.js:105)

我的离子照相机版本为"@ionic-native/camera": "^4.3.0"

操作表或本机插件是否存在问题?

我的相机正在启动但无法正常工作。

以下是相机的打字稿代码

 const actionSheet = this.actionSheetController.create({
      title: 'Actions',
      buttons: [{
        text: 'upload',
        role: 'destructive',
        icon: 'upload',
        handler: () => {
          console.log('camera clicked');
          const options: CameraOptions = {
            quality: 100,
            destinationType: this.camera.DestinationType.FILE_URI,
            encodingType: this.camera.EncodingType.JPEG,
            mediaType: this.camera.MediaType.PICTURE,
            sourceType: this.camera.PictureSourceType.PHOTOLIBRARY,
          };

      this.camera.getPicture(options).then((imageData) => {
        this.ProfileInfo.profileImagePath = 'data:image/png;base64,' + imageData;
        this.ProfileInfo.profileimage = imageData;
        this.updateImage(this.ProfileInfo);

      }, (err) => {

      });
    }
  }, {
    text: 'camera',
    icon: 'camera',
    handler: () => {
      console.log('camera clicked');
      const options: CameraOptions = {
        quality: 100,
        destinationType: this.camera.DestinationType.FILE_URI,
        encodingType: this.camera.EncodingType.JPEG,
        mediaType: this.camera.MediaType.PICTURE,
        sourceType: this.camera.PictureSourceType.CAMERA
      };

      this.camera.getPicture(options).then((imageData) => {

        this.ProfileInfo.profileImagePath = 'data:image/png;base64,' + imageData;
        this.ProfileInfo.profileimage = imageData;
        this.updateImage(this.ProfileInfo);

      }, (err) => {

      });
    }
  }, {
    text: 'Cancel',
    icon: 'close',
    role: 'cancel',
    handler: () => {
      console.log('Cancel clicked');
    }
  }]
});
actionSheet.present();

0 个答案:

没有答案