如何在Ionic 4中的iPhone上显示base64图像

Luc*_*dro 1 ionic-framework angular ionic4 capacitor

我正在使用电容器插件来获取图像文件(从相机或图库)。PC 和 Android 运行良好,但代码在 iPhone 上崩溃。

它打开图库,我抓取图像,但在尝试显示时崩溃了

我检查了权限,它们都已设置。为什么只在ios上会崩溃?是不是弦有问题?安全?

HTML:

< ion-img role="button" class="image" [src]="selectedImage" *ngIf="selectedImage" >
Run Code Online (Sandbox Code Playgroud)

交易代码:

Plugins.Camera.getPhoto({
    quality: 100,
    source: CameraSource.Prompt,
    correctOrientation: true,
    allowEditing: false,
    resultType: CameraResultType.Base64
})
 .then(image => {
      this.selectedImage = image.base64Data; // VAR TO DISPLAY IN HTML
  })
Run Code Online (Sandbox Code Playgroud)

错误日志

在此输入图像描述

编辑:现在我使用 DomSanitizer 和 SafeResourceUrl 来变量。错误停止了,但图像不会显示

Kab*_*bir 5

改变这一行

this.selectedImage = "data:image/jpeg;base64, " + image.base64Data;
Run Code Online (Sandbox Code Playgroud)