user1162034
user1162034

Reputation: 71

Why are images shown only on simulator but not on device (iPad)

My array has the value:

imageArray = [[NSArray alloc]initWithObjects:@"image1.png",@"image2.png",@"image3.png",@"image4.png",@"image5.png",@"image6.png",@"image7.png",@"image8.png",@"image9.png",@"image10.png",@"image1.png",@"London.png",@"image2.png",@"image3.png",@"image4.png",@"image5.png",@"image6.png",@"image7.png",@"image8.png",@"image9.png",@"image10.png",nil];

I want to show these images in a scrollview. All the images appear except @"London.png", which is appearing as blank. How do I fix this?

Upvotes: 1

Views: 539

Answers (4)

Rok Jarc
Rok Jarc

Reputation: 18865

I've come across the same problem when i wasn't carefull about capital letters in file names. For example file Image.png (if called as @"image.png" from code) was normally shown in simulator but not on device. So make sure your names match exactly. Is your file London.png actually london.png?

And it has to be added to the project and to the target.

Upvotes: 4

mwfire
mwfire

Reputation: 1667

Besides the case, images are even displayed without the extension on the simulator.

While [UIImage imageNamed:@"test"] does work on the simulator, it will not on an actual device, it has to be [UIImage imageNamed:@"test.png"]

Upvotes: 1

Vincent Zgueb
Vincent Zgueb

Reputation: 1491

1 - Open your [myApp].app product folder and check your images are really embedded.

2 - Check that your image is really a png and not a simply renamed jpeg.

Upvotes: 1

meronix
meronix

Reputation: 6176

...if error persists try to save again your png files. sometimes png files are not saved in the right format, and even if you can see them on a mac (and in simulator) they are not readable in IOS devices

Upvotes: 1

Related Questions