Image shows up in simulator but not device

Discussion in 'Public Game Developers Forum' started by kohjingyu, Oct 20, 2009.

  1. kohjingyu

    kohjingyu Well-Known Member

    Mar 20, 2009
    1,770
    0
    0
    Student/Developer
    Singapore
    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. :)
     
  2. kohjingyu

    kohjingyu Well-Known Member

    Mar 20, 2009
    1,770
    0
    0
    Student/Developer
    Singapore
    I've tried everything...And the image names are correct...Any idea why?
     
  3. lukeca

    lukeca Well-Known Member

    Jul 22, 2009
    317
    0
    0
    Are they the correct case (capital letters vs lowercase letters)? The simulator is not case sensitive but the iPhone is.
     
  4. kohjingyu

    kohjingyu Well-Known Member

    Mar 20, 2009
    1,770
    0
    0
    Student/Developer
    Singapore
    Yes, they are correctly typed. I found the problem, turns out they were .jpg files but I named them .png files or something...LOL.
     
  5. 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. :)
     
  6. kohjingyu

    kohjingyu Well-Known Member

    Mar 20, 2009
    1,770
    0
    0
    Student/Developer
    Singapore
    Haha...Thanks anyway. :)
     

Share This Page