Xcode是否可以包含在生成过程中生成的应用程序资源文件? [英] Can Xcode include application resource files that are generated during the build process?
问题描述
我有很多通过外壳程序脚本为iPhone应用程序生成的内容文件。作为Xcode构建过程的一部分,它花费的时间太长,所以我定期运行它。
I have a bunch of content files for my iPhone app that I generate via shell script. It takes way too long to be a part of the Xcode build process, so I run it periodically.
我不想将这些文件连续添加到我的计算机中Xcode项目为了让它们包含在我的应用程序资源文件夹中。有没有一种方法可以让Xcode在构建时将文件夹的内容复制到应用程序资源中? (如果我可以指定其他位置,例如approot文件文件夹,那将是一个好处。)
I don't want to have to continually add these files to my Xcode project in order to get them included my app resources folder. Is there a way to get Xcode to copy the contents of a folder into the app resources at build time? (It'd be a bonus if I could specify other locations, such as the approot documents folder.)
我尝试在我的计算机上添加新的复制文件构建阶段目标,但这似乎不起作用。这似乎是一个常见问题,但是我在这里找不到任何相关信息。
I tried adding a new 'Copy Files Build Phase' to my target, but that didn't seem to work. This seems like a common problem, but I couldn't find anything about it here.
-编辑(我做了什么)
Per Jasarien和cdespinosa的建议,我在构建脚本中进行了以下操作。我决定不复制到目标位置,因为这仅在使用模拟器时有效,我认为在将其部署到设备时不会有效。
Per Jasarien and cdespinosa's suggestions, I did the following in a build script. I decided not to copy to the destination, because that would only work when using the simulator, I don't think that'll work when deploying to a device.
cp -rf "$PROJECT_DIR/mystuff" "$CONFIGURATION_BUILD_DIR/$CONTENTS_FOLDER_PATH/"
-编辑2
似乎没有将文件保存到我的iPhone上。有任何想法吗?
This doesn't appear to get files onto my iPhone. Any ideas?
推荐答案
您可以在应用程序目标中设置运行脚本构建阶段。编写脚本,以便将资源复制到应用程序包中。
You can setup a Run Script build phase in your app's target. Write the script so that it copies the resources into the app bundle.
这篇关于Xcode是否可以包含在生成过程中生成的应用程序资源文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!