views:

56

answers:

3

I am learning iPhone development, and have built a simple app that has an image that changes to another image when you tap it.

If i build it to the simulator, it works fine, but if i build it to the device the images dont appear. i feel like they aren't being copied across. I have checked they have been named correctly and i have made sure i imported them to 'resources'

I dont think it is a problem with the code because i added a thing to also make text appear when the image is tapped, and this works, so a button is still there doing something, it just doesn't have an image on it.

A: 

Is it the case with only PNG images or also for JPG & other format you're having same issue. If it's only for PNG image, then it might be possible they're not being compressed. Try the following way.

Select your project target & go into its info. Here go into the build tab. In the configuration select "All Configurations" from Configuration section. Now, write "COMPRESS_PNG_FILES' in the search bar. And see the status of the check-box. IF it's unchecked, then make it checked & it will work. But if it's already checked, then there should be other reason in your project.

In the later case, I would request you to create a new dummy project & check by adding 2-3 images whether it's coming or not.

Sagar
the images are jpegs, but in an unrelated incident, the App's icon is a png and that doesn't appear. ill try your compress idea for that
+3  A: 

Does the case (upper/lower) of all your file names match exactly for all letters? Source code & project & Mac?

hotpaw2
that is the most likely problem, and i'll have another, more thorough check. however, if this was the problem, why would the images appear in Simulator? (sorry if it's completely different and that's a dumb question)
Because the Simulator runs on the Mac's filesystem, which is case-preserving, case-insensitive, while the iOS device filesystem is case-preserving, case-sensitive.
Wevah
A: 

Have you placed your images in your Project folder in disk, or are you adding them to your project Resources from some other folder( which is not in your Project folder )

iphoneDev
i dragged them into Resources from the desktop, but checked the box that said 'Copy to project folder' when i did this. is this bad practise? should i manually copy them to the project's folder?
iphoneDev
That shouldn't matter as long as it's in the `Resources` directory in the application bundle.
Wevah