首页 > 解决方案 > 无法在 ionic 3 中执行“createObjectURL”

问题描述

[在此处输入图像描述][1]我在使用操作表打开相机时使用了面临的问题并出现以下错误。

CameraProxy.js:105 未捕获类型错误:无法在“URL”上执行“createObjectURL”:未找到与提供的签名匹配的函数。在成功回调(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();

标签: ionic-frameworkcordova-pluginsreact-native-android

解决方案


推荐阅读