views:

45

answers:

2

Hello,

I've been trying to update an image that is packaged with my app, but the app refuses to load the new file.

I originally had a png called "board.png". I then created a new file which is a higher resolution copy of the original. I deleted "board.png" from the Resources group in XCode and added the new image under the same name. When I run the app, the old, smaller image is still used.

Then, I cleaned the build and tried again. Still doesn't work. Next, I renamed the new image to "BigBoard.png" and tried loading that filename thusly:

UIImageView* board = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"BigBoard.png"]];

but the image does not load at all even though it is in the Resources folder. Does anyone else have any experience with this? Any help would be greatly appreciated.

Thanks!

A: 

I had the same problem twice now.

The first time I had just forgotten to check the 'Copy items into destination group's folder' option when I added the new image so the image want actually in the folder when I went to build.

The second time I needed to clean all targets (Build -> Clean All Targets) before I built again. This gets rid of all the precompiled stuff and forces xcode to completely recompile the project. When I did this the build results showed an extra action CopyPNGFile "path/to/image/image.png" so I think it was avoiding adding new image because it saw a precompiled version of it there already.

See if either of those fixes it.

Harro
Thanks for the hints. I tried both of these but they do not seem to solve the problem. I had to actually go into the package contents and copy the file there myself. If it makes things any clearer, this problem only occurred once I converted the iPhone app into an iPad app.
iPhoneARguy
A: 

Hey all,

I actually found the solution to this problem a little while ago. Since I converted my iPhone project into an iPad project, the new files I add to the project were not added automatically to the iPad target and would not be present in the iPad executable. To solve this problem, I had to manually add the files to the iPad target by right clicking the file -> Get Info -> Targets -> Check iPad target.

The recent XCode update also fixes this problem so you no longer have to manually add the targets.

iPhoneARguy