Ionic 4: The “src” content of an “img” tag is not updating when I change it from the controller in IOS

I am developing an app for Android and IOS.

I have a profile page where the user can change profile pictures. The photo appears in the view and is changed in real time.

My code is like this in the view:

<img alt="logo" style="width:15vh; height:15vh; border-radius: 50%;" src="{{pictureusuariomenu}}">

pictureusuariomenu is a variable found in the controller.

With that variable what I do is, it is the URL of the image that I upload, I update it there. here is the function:

updateStoredImages(name) { => {
        let arr = JSON.parse(images);
        if (!arr) {
            let newImages = [name];
  , JSON.stringify(newImages));
        } else {
  , JSON.stringify(arr));

        let filePath = this.file.dataDirectory + name;
        let resPath = this.pathForImage(filePath);
       // alert(resPath);

        let newEntry = {
            name: name,
            path: resPath,
            filePath: filePath
        this.images=[]; //borrar las imagenes anteriores (no crear la lista de imagenes)
        this.images = [newEntry, ...this.images];
        this.urlImage = this.images[0].path;
        this.ref.detectChanges(); // trigger change detection cycle

In this line:


What I do is:


Now in android is working fine this way of updating the profile image in view:


enter image description here


enter image description here

But in IOS this isn’t working. The view is not updated at all


enter image description here


enter image description here

Nothing appears, just a few letters. But the view doesn’t update in IOS.

What could it be?

My specifications:

enter image description here

Please check this topic as well, with the “solution”.
Seems to be some issue with change detection in Ionic. I’m seeing this behavior in two of mine apps since Ionic 5.

1 Like