Xcode- Deleted images appear in simulator
Asked Answered
T

8

15

Mac OS X Lion v10.7.2 Xcode v4.2.1 Build 4D502 gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00) GNU gdb 6.3.50-20050815 (Apple version gdb-1708) (Thu Nov 3 21:59:02 UTC 2011)

I have a bunch of images in my resource folder, but when I delete those images and run in simulator again, the images are still there. I have completely deleted the images from the Project Editor window (not from Finder), and I used DELETE (not Remove Reference Only), and they are still showing up in the simulator. If I add new images back in (with the same names) thru the Project Editor window (not from Finder) the old ones are still being used as well instead of the new ones.

I have tried:

1) Deleting images from Project Editor window.

2) Delete app from simulator (click and hold, then delete while wobbling), then restart computer.

3) Choosing Product > Clean.

4) Choosing Product > Option+Clean.

5) Choosing Show Package Contents of .xcodeproj file, and deleting everything in the xcuserdata folder.

This is an incredibly annoying bug!

How do I tell Xcode to stop using cached images?

I am newbie, so something like "Clean Targets" does not mean anything to me, unless you give me the instructions on how to do it as well.

Thanks

EDIT:

Here is another option we all missed, which might do the same thing as deleting the /Simulator/../Applications folder: In the iOS Simulator menu, there is an option called Reset Content and Settings ... it never occured to me that the simulator was a separate app from Xcode, so I never thought to check menu items while simulator had focus!

Tieck answered 11/1, 2012 at 14:53 Comment(2)
That's really weird. Try viewing your project in Finder and see if you can find any images floating around somewhere in your project that Xcode just isn't showing that might be causing trouble.Coray
@"sudo rm -rf" (yikes on the username) I tried that too and cannot find anything.Tieck
U
16

Manually removing the build folder may help. Clean does not always do this properly, for reasons unknown. The build folder used to be in the project directory, but now (also) exists in ~/Library/Developer/Xcode/DerivedData/


Solved by original poster:

Oh wait I had a brainstorm because of your suggestion above, and from Terminal I used: find . -name 'myimage.png' 2> /dev/null and I found the secret hidden cache! It is in my user library here: ~/Library/Application Support/iPhone Simulator/4.3.2/Applications/ Just delete everything in the Applications directory. May also need to do this one as well: ~/Library/Application Support/iPhone Simulator/5.0/Applications/

Unwished answered 11/1, 2012 at 14:59 Comment(11)
That is why you should remove them! Or use spotlight to locate the file on your disk.Unwished
Sorry, I meant they are still there as in showing up in the simulator, after I deleted the deriveddata folder as you suggested.Tieck
Ok, then use spotlight to find the location of these mysterious files. Then remove them.Unwished
I tried that already too, and they do not appear to exist anywhere in the system!Tieck
Oh wait I had a brainstorm because of your suggestion above, and from Terminal I used: find . -name 'myimage.png' 2> /dev/null and I found the secret hidden cache! It is in my user library here: ~/Library/Application Support/iPhone Simulator/4.3.2/Applications/ Just delete everything in the Applications directory. May also need to do this one as well: ~/Library/Application Support/iPhone Simulator/5.0/Applications/Tieck
@Tieck I added your solution to the answer so others in the future can see it also.Coray
Note that these are not secret/hidden/cached files, but just the apps that are installed in the simulator. They should be removed by simply removing them from the simulator springboard.Unwished
I had tried that as one of my steps (deleting app from the simulator springboard), but it did not work. I know they are not really "secret" but I could not figure it, and another friend of mine was having the exact same problem!Tieck
Interesting, I've seen those folders disappear when deleting apps. Are you sure you deleted all these things (apps, build folders, etc) with not a single build/run in between?Unwished
Absolutely positively maybe I think! I usually shutdown Xcode and then go delete everything and then start it back up to be safe. But from a newbie perspective, Xcode is extremely complicated!Tieck
Here is another option we all missed, which might do the same thing as deleting the /Simulator/../Applications folder: In the iOS Simulator menu, there is an option called Reset Content and Settings ... it never occured to me that the simulator was a separate app from Xcode, so I never thought to check menu items while simulator had focus!Tieck
E
4

I had the same thing when I was adding transparent background to an image that was already part of the project.

What worked:

1) Delete app from Simulator (long press and hit X).

2) Also I had to remove old image files from project and then reload the new transparent background images into the project.

Also hit Project > Clean multiple times.

Elan answered 4/6, 2012 at 10:48 Comment(1)
Removing image from project and adding it again did the trick. None other work (clean, rebuild, delete Derived datas, delete applications from Simulator folder)Tyndall
P
3

I had the same. Very strange because the simulator displayed the no longer existing images and the development-phone displayed the correct images.

I had already removed them from the folder. And deleted them from the simulator. For me a Product > Clean did the trick.

Pennell answered 23/5, 2012 at 10:20 Comment(0)
C
0

After I did the "remove fromfolder"/"Reset content and setting"/remove app from simulator", I still had an old image hanging around in the simulator. Then I did a "Project>clean". Then the detailViewController.xib file disappeared from the folder. It is still present in XCode, but can not be found anymore when running the app in the simulator, cousing a crash. What is the problem here?

Chivy answered 26/9, 2012 at 18:36 Comment(1)
You should start a new question if you are looking for answers, and reference this question in your new question.Tieck
W
0

I believe that since Lion, this has changed to '/Users/[user name]/Library/Application Support/iPhone Simulator/[version number]**'. Be careful however, the Library folder is hidden. To view it, open the Terminal and run this:

defaults write com.apple.Finder AppleShowAllFiles YES
Well answered 29/11, 2012 at 12:40 Comment(0)
W
0

I had to

1) Delete the images from the folders.

2) Delete the app from the simulator.

3) Clean.

4) Stop the simulator and restart.

Only when I had done each of these could I get rid of old resources

Wendiewendin answered 14/4, 2013 at 13:55 Comment(0)
D
0

I had this issue as well. Deleting the app from the simulator (In the simulator do Hardware -> Home, click + hold on app icon till icons jiggle, click the x just like you would do on a device). Running again used the correct images.

Diadiabase answered 22/3, 2014 at 22:42 Comment(0)
V
0

Running sudo rm -rf ~/Library/Application\ Support/iPhone\ Simulator/7.*/Applications fixed the problem for me. You might have to change the 7, depending on which version you'll have in ~/Library/Application Support/iPhone Simulator

Voight answered 6/1, 2015 at 10:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.