Thursday, October 1, 2009

Beware simulator caches

I just burnt too much time in a "how the fuck is it doing that?!?" situation.

I was trying to check (on the simulator) a failure case in an iPhone app where it makes an HTTP request for an image but it fails. Easy to test, just turn off Airport, unplug the ethernet, and I am all good.

Amazingly, though, the request succeeded. WTF. Oops, I forgot to get rid of my own cache. And rather than just delete the file, lets just make sure and reset the simulator to make sure everything is gone. That will do it.

Run the test and the image is retrieved. Double WTF.

After more fiddling around and increasing magnitudes of WTFs, while looking in /Users/me/Library/Caches to see if there was a simulator cache a co-worker I asked for another set of eyes noticed that there was a com.. cache. Deleted it and the request finally failed.

Kind of a bug no? Certainly the behavior is markedly different from the device and at the very least it should be deleted upon resetting the simulator or deleting the app from the simulator.

No comments:

Post a Comment