Mark
Mark

Reputation: 1320

Objective C: imageNamed loading non existing image

I use a loop to load images into an NSMutableArray. Each iteration loads an images using the imagedNamed function in UIImage: [UIImage imageNamed:*name*];.

However, I wanted to change some of the images. So I removed the images from the project and added the new ones. But when I run the app in the iOS-simulator, the old images appear. Even when I remove all images from the project, they still appear.

Can someone explain why this is happening, and how I can change it?

Upvotes: 1

Views: 614

Answers (4)

Deepak
Deepak

Reputation: 348

Clean your project CMD + SHIFT + K (XCODE 4.3 and above). sometimes reference of deleted items remains in the project and make sure that u reset your simulator also.

Upvotes: 2

gauravds
gauravds

Reputation: 3011

delete app from simulator, clean project and make sure that image exist. Image name is case sensitive. It may see on simulator but on device image will not display

Upvotes: 0

James Webster
James Webster

Reputation: 32066

The problem is that XCode hasn't recognised the new resources and usually the only way to fix it is to delete the old resources from the build folder.

Cmd + Opt + Shift + K cleans all targets and the build folder. This should fix it

Upvotes: 5

Zoleas
Zoleas

Reputation: 4879

Did you clean your project in XCode ? Sometimes when you change some resources like images, XCode doesn't copy the new ones one the simulator / device.

To do so, go to "Product" -> "Clean"

Upvotes: 1

Related Questions