Ionic Native Camera not displaying taken photo with ionic cordova run ios


#1

For the past couple months I couldn’t get camera taken images to show when livereload was enabled, now I can’t get it at all with ionic cordova run ios. It does work via the Ionic View app, but makes testing slow. Is anyone else running into this?
Here is my info:

cli packages:

    @ionic/cli-plugin-cordova       : 1.6.2
    @ionic/cli-plugin-ionic-angular : 1.4.1
    @ionic/cli-utils                : 1.7.0
    ionic (Ionic CLI)               : 3.7.0

global packages:

    Cordova CLI : 7.0.1 

local packages:

    @ionic/app-scripts : 1.3.7
    Cordova Platforms  : android 6.1.2 ios 4.3.1 windows 4.4.3
    Ionic Framework    : ionic-angular 3.3.0

System:

    Node       : v6.11.0
    OS         : macOS Sierra
    Xcode      : Xcode 8.3.2 Build version 8E2002 
    ios-deploy : 1.9.1 
    ios-sim    : 6.0.0 
    npm        : 3.10.10 

#2

Here is the code (imagURI then just updates the [src]):

  getImage(): Promise<string> {
    return new Promise((resolve, reject) => {

      const options: CameraOptions = {
        quality: 100,
        sourceType: this.camera.PictureSourceType.PHOTOLIBRARY,
        destinationType: this.camera.DestinationType.FILE_URI,
        encodingType: this.camera.EncodingType.JPEG,
        targetHeight: 700,
        targetWidth: 700,
        mediaType: this.camera.MediaType.PICTURE
      }

      this.camera.getPicture(options)
        .then(imageURI => resolve(imageURI), err => reject(err));
    })
  }```

#3

This seems to be a WKWebView issue. Import normalizeUrl from ionic-angular, and, in your case, do
return normalizeUrl(imageURI)
Did the trick for me.