Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force XCode 4 to always update resources?

Tags:

ios

xcode4

I am adding resources (lots of .pngs and other) to my iPhone project dragging the folder to it and choosing "Create Folder references for any added Folder", to retain the folder structure. They are correctly added to the Copy Resources build phase.

Problem is, I am wasting A LOT of time because when I create/delete/update a new resource, it will often ignore changed files and stick with the older version.

Looks like it tries to only updates resources when they are changed, but it fails to see the changes. In the simulator it was possible to manually update the files in the .app, but when working on the device it will complain that the code sign of some resources has changed!

The only reliable way I've found to force it to update everything is deleting the build products, the app and the device app some times, until it finally decides to forget about the old version, but doing this for each resource change is wasting me an insane amount of time (game content changes more than often).

So, in short: how do I force XCode to disable "versioning" and to just scrap all the resources and copy them all each time?

Thanks!

EDIT: I have found that deleting the .app folder built in "build" folder always forces XCode to add new files...

I still have no clue on where it keeps the old files when I delete that folder, but this is for the better as it only copies new resources as intended. So a simple script like

rm -rf "$CODESIGNING_FOLDER_PATH"

Does the trick of deleting the folder at each build...

Unfortunately, XCode apparently runs the codesigning BEFORE anything in the Build Phases tab is executed, so it updates the old target, the script deletes the old target, and then it crashes complaining that no Code Signing Resources were found.

So... I have to stick with manually deleting the file, or is there a way to run a script before code signing?

like image 530
Tom89 Avatar asked Jul 20 '11 18:07

Tom89


1 Answers

I had this kind of issue as well, about files not getting updated when I built my project (A PhoneGap project, but that should not matter).

What I did, was add this to the Build Phase of my project:

find "${PROJECT_DIR}/www/." -exec touch -cm {} \;

That will make sure the files are being picked up as updated when XCode builds the project. Of course, you should modify the command to your needs - my needs were to update the www folder on build, as I am editing my files using Visual Studio, running in a VM.

like image 149
Jeff Avatar answered Oct 23 '22 04:10

Jeff