构建时如何让 Xcode 始终复制文件(即使它们未被检测为修改)?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1710167/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to have Xcode always copy files (even if they have not been detected as modified) when building?
提问by Form
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(nota group) to my javascript folder, which automatically added the folder to the Copy Bundle Resources build phase.
我正在开发一个应用程序,它使用存储在我的应用程序包的 Resources/javascript 文件夹中的 .js 文件。在我的 Xcode 2.5 项目中,我为我的 javascript 文件夹创建了一个文件夹引用(不是一个组),它会自动将该文件夹添加到复制捆绑资源构建阶段。
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.
我遇到的问题是,当我修改 .js 文件时,我需要清理我的项目,然后重新构建它,以便在构建时将修改后的 .js 文件复制到我的应用程序包中。这是非常耗时的,因为我重新构建整个项目只是为了在我的应用程序包中获取更新的 .js 文件。
Could someone tell me how to get Xcode to always copy specific files in the build phase?
有人能告诉我如何让 Xcode 在构建阶段始终复制特定文件吗?
Thanks in advance!
提前致谢!
采纳答案by Joshua Nozzi
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).
您可以右键或控制单击文件(在项目文件列表中)并在构建(手动)之前单击“Touch”或将脚本构建阶段添加到调用“touch myfile.js”的目标并将其放在您的 Copy 之前文件构建阶段(自动)。
回答by MarkPowell
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.
这将在目标下创建阶段。将要复制的文件拖到阶段。