lunes, 6 de mayo de 2013

I thought I removed the file...

Sometimes, when you are sure that everything is alright because the app runs perfectly on all your devices, one of your testers report a bug saying that the app shuts down while loading in some scene (well, they just say something like "yeah.. I select all the items and then, it closes and I cannot continue"). You have very few information, so you start summarizing:
  1. It cannot be memory warning (always first guess, but you test with an iPad 1, the iPad 3 cannot raise this problem)
  2. It cannot be a weird behavior of the inner logic because it is just a background and some sprites...
  3. This scene had previously worked, and then I changed the background...
  4. If the background is not found?
  5. (After look in the project) But the background is not in the project... Why is it working in my devices if there is no image?!
It has happened to me to many times so I decided to write this post.
The first time I saw this issue was when refactoring my code and stop using retina resources, so it turned from having background-hd.jpg and background.jpg to just background.jpg. I removed the file from the project, clean the cache and made sure it wasn't the old file there anymore. But, somehow, XCode seemed to remember it, so when I asked for this file in my devices was ok but my testers iPad hadn't that resource and crashed.
I was very crossed, because I didn't want to rename all files to solved the problem. So, I asked the Almighty and found some solutions on Stackoverflow. The problem relied on XCode's derived cache, and there were offered some solutions:
  1. Clean via XCode (source)
    • The problem remained
  2. Going to the folder in your laptop and cleaning the data manually: ~/Library/Developer/Xcode/DerivedData/ (source)
    • It didn't worked for me, my corresponding folder was empty
  3. Delete app, clean everything, empty caches (source)
    • Still there
How did I solved the problem? I did not solve it :( I solved my concrete bug manually, by renaming the files and the path names in the code.
Why did I write this post? To show you potential problems you may have with XCode and the resources, and a non-perfect solution for it. Also, if you find a good way to get rid of this ridiculous issue that makes stupid names of our resources, feel free to share it with a comment.




No hay comentarios:

Publicar un comentario