Cannot load images in ios build


#1

Hello,
I’m completely stuck trying to display images in an ios build of my app. It works for web deploy (ionic serve) using <img class="center-logo" src="assets/img/appicon.png"/>.

ionic CLI version 3.20.0
ionic angular dependency: 3.9.2

I have tried EVERYTHING in this post:
https://stackoverflow.com/questions/42830752/ionic-2-images-not-displaying-on-device.

The most common solution seems to be declare the image like this (which doesn’t work):
<img class="center-logo" src="assets/img/appicon.png"/>

Also, to look out for errors in case. I definately have correct case.

I can see my image is in the ios/www/assets/img directory.

I have tried every conceivable path to the this location:

<h3>assets/img/appicon.png</h3>  
  <img class="center-logo" src="assets/img/appicon.png"/>
   <h3>/assets/img/appicon.png</h3>  
  <img class="center-logo" src="/assets/img/appicon.png"/>
  <h3>./assets/img/appicon.png</h3>  
  <img class="center-logo" src="./assets/img/appicon.png"/>
  <h3>www/assets/img/appicon.png</h3>  
  <img class="center-logo" src="www/assets/img/appicon.png"/>
  <h3>./www/assets/img/appicon.png</h3>  
  <img class="center-logo" src="./www/assets/img/appicon.png"/>
  <h3>/www/assets/img/appicon.png</h3>  
  <img class="center-logo" src="/www/assets/img/appicon.png"/>
  <h3>../assets/img/appicon.png</h3>  
  <img class="center-logo" src="../assets/img/appicon.png"/>
  <h3>../../assets/img/appicon.png</h3>  
  <img class="center-logo" src="../../assets/img/appicon.png"/>
   <h3>../../../assets/img/appicon.png</h3>  
  <img class="center-logo" src="../../../assets/img/appicon.png"/>
   <h3>src/assets/img/appicon.png</h3>  
  <img class="center-logo" src="src/assets/img/appicon.png"/>

Thanks for any help, this is blocking release of our application, help much appreciated.
Brett


#2

hey @wbrett30, have you checked the extension type’s case. Sometimes its PNG and in code we mostly use png in small letters. Make sure that it is correct because in web mode (ionic serve) it shows even if you use png in small letters for PNG extension.


#3

Hi,
Thanks alot for replying. I’ve double checked that, its not a problem of case on .png. Note that the image displays on the ios simulator, but not on a real iphone (testing with iphone 7, ios 11.4). Still stuck please help… anybody!!!
Brett