How to have Xcode always copy files (even if they have not been detected as modified) when building?

末鹿安然 提交于 2019-12-01 16:38:31

问题


I am developing an application which uses .js files stored in the Resources/javascript folder of my application bundle. In my Xcode 2.5 project I have created a folder reference (not a group) to my javascript folder, which automatically added the folder to the Copy Bundle Resources build phase.

The problem I have is when I modify my .js files, I need to clean my project then re-build it for the modified .js files to get copied into my application bundle when building. This is very time consuming since I re-build the whole project just to get an updated .js file in my app bundle.

Could someone tell me how to get Xcode to always copy specific files in the build phase?

Thanks in advance!


回答1:


You could right- or control-click the file (in the project file list) and click "Touch" before building (manual) or add a script build phase to the target that calls "touch myfile.js" and place it before your Copy Files build phase (automatic).




回答2:


Add a new Copy Files Build Task to your target.

Right Click (Control Click) on the target, Add -> New Build Phase -> New Copy Files Build Phase.

In the Dialog select the destination that you want the files to be copied.

This will create the phase under the target. Drag the files you wish to copy to the phase.




回答3:


There's an excellent walkthrough here of a build phase script which automates the 'touch' and saves the manual step of specifying each file you want included.



来源:https://stackoverflow.com/questions/1710167/how-to-have-xcode-always-copy-files-even-if-they-have-not-been-detected-as-modi

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!