★ TouchArcade needs your help. Click here to support us on Patreon.

Image shows up in simulator but not device

10-20-2009, 09:13 AM
#1
Joined: Mar 2009
Location: Singapore
Posts: 1,770
Send a message via AIM to kohjingyu
Image shows up in simulator but not device

Hey guys,
An image in my app is showing up in the simulator but not the device. I'm using [UIImage imageNamed:]; and all my image names are referenced correctly. I did a clean build as well as deleting the app from my iPhone and reinstalling. I also tried deleting the images and re-adding them, but still nothing.

Any help?

Thanks.
10-21-2009, 12:10 AM
#2
Joined: Mar 2009
Location: Singapore
Posts: 1,770
Send a message via AIM to kohjingyu
I've tried everything...And the image names are correct...Any idea why?
10-21-2009, 12:52 AM
#3
Joined: Jul 2009
Posts: 317
Are they the correct case (capital letters vs lowercase letters)? The simulator is not case sensitive but the iPhone is.
10-21-2009, 02:36 AM
#4
Joined: Mar 2009
Location: Singapore
Posts: 1,770
Send a message via AIM to kohjingyu
Yes, they are correctly typed. I found the problem, turns out they were .jpg files but I named them .png files or something...LOL.
10-21-2009, 02:40 AM
#5
Joined: Sep 2009
Location: Vancouver, Canada
Posts: 977
Send a message via MSN to MindJuice Send a message via Skype™ to MindJuice
I would guess it would be one of the following:
  • The file format is somehow bad and the the simulator can read it but iPhone can't (unlikely, but...). You can try to rename myimage.png to myimage-old.png. Then create a new simple image and name it myimage.png and try loading that. Maybe create an image with a different program or use a downloaded image as a test too.
  • The filename is bad or wrong. Try changing the name of the image, add it to your project, and change the code to load the new filename.
  • The file is not included in the generated .app. Build your iPhone target and then check the build output. Right click on the generated .app file and select Show Package Contents. Make sure the image file shows up there. If not, then right click the file in XCode and select Get Info. Make sure the image is included in the Target you are building.
  • The file is included, but is in a sub-folder. Make sure to add the folder name before the image name.
I realize that some of these shouldn't result in a situation where it works on the simulator and not on the iPhone, but hopefully something in there is helpful.

Edit: Of course right after I post this, you found the problem.
10-21-2009, 02:44 AM
#6
Joined: Mar 2009
Location: Singapore
Posts: 1,770
Send a message via AIM to kohjingyu