How to force Xcode 4 to always update resources?

I add resources (a lot of .png and others) to my iPhone project by dragging a folder into it and selecting "Create folder links for any added folder" to save the folder structure. They are correctly added to the build phase of copy resources.

The problem is that I spend a lot of time, because when I create / delete / update a new resource, it often ignores the changed files and sticks to the older version.

It seems that he is trying to update resources only when they change, but does not see the changes. In the simulator, you could manually update the files in .app, but when working with the device, it will complain that the code of some resources has changed!

The only reliable way I found to get it to update everything is to delete the assembly products, application and device application several times until it finally decides to forget about the old version, but this is done for every change of the resource, an insane amount is wasting me time (game content changes more often than often).

So, in a nutshell: how to get Xcode to turn off "version control" and just drop all resources and copy them every time?

Thanks!

EDIT: I found that deleting the .app folder created in the "build" folder always forces Xcode to add new files ...

I still don’t know where it stores the old files when I delete this folder, but it’s for the better, since it only copies the new resources to the destination. So a simple script like

rm -rf "$CODESIGNING_FOLDER_PATH" 

Is a trick used to delete a folder on every build ...

Unfortunately, Xcode apparently does the code coding before anything on the Phase Assemblage tab is executed, so it updates the old target, the script deletes the old target, and then crashes complaining about the lack of resources for signing the code.

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

+6
source share
3 answers

I also had such a problem when the files were not updated when creating my project (PhoneGap project, but it does not matter).

What I did added this to the build phase of my project:

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

This will make sure that the files are selected as updated when Xcode creates the project. Of course, you have to change the command to your needs - I needed to update the www folder during assembly, since I edit my files using Visual Studio running in a virtual machine.

+5
source

Well, I finally found a (somewhat ugly) workaround for this.

In your project, create two aggregate goals, say Clean Build and Cleaner.

  • In Cleaner, add the “Run Script” phase with rm -rf "$CODESIGNING_FOLDER_PATH" , which will clear the temporary application from the build folder.

  • In Clean Build, add Cleaner first, and then your regular app target in the target dependencies.

  • Select “Clean Assembly” from the launch list, then “Edit Schema” and set the target application as an executable file. Hit run and it should work :)
+1
source

You may want to use the “Clear” option in the “Product” menu (or hold down the “Shift” key and press the “K” key) after updating the resource and before creating the updated application. I noticed that it helped me from time to time when I update the resource or customization of the assembly.

0
source

Source: https://habr.com/ru/post/893198/


All Articles