Unable to display image in iOS


#1

Using the Camera plugin I am unable to display image on just IOS device. I am also passing hardcode image path but still unable to display image :frowning:

The following is my code:

public takePicture(sourceType) {
// Create options for the Camera Dialog
var options = {
quality: 100,
sourceType: sourceType,
saveToPhotoAlbum: false,
correctOrientation: true,
destinationType: this.camera.DestinationType.FILE_URI

};

// Get the data of an image
this.camera.getPicture(options).then((imagePath) => {
  //this.errors = imagePath;
  // Special handling for Android library
  if (this.platform.is('android') && sourceType === this.camera.PictureSourceType.PHOTOLIBRARY) {
    this.filePath.resolveNativePath(imagePath)
      .then(filePath => {
        let correctPath = filePath.substr(0, filePath.lastIndexOf('/') + 1);
        let currentName = imagePath.substring(imagePath.lastIndexOf('/') + 1, imagePath.lastIndexOf('?'));
        this.copyFileToLocalDir(correctPath, currentName, this.createFileName());
      });
  } else {
    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.');
});

}

and getting the path:
public pathForImage(img) {
if (img === null) {
return ‘’;
} else {
return cordova.file.dataDirectory + img;
}
}