Xcode 针对不同目标使用不同资源
我正在开发一个 iPhone 应用程序,该应用程序将有完整版和精简版。 为了从相同的源代码和 Xcode 项目中获取这两个包,我向 Xcode 项目添加了另一个目标。
现在,我想让 Lite 目标仅将资源文件的子集复制到捆绑包中。 但是,Xcode 不会简单地让我从“将文件复制到捆绑包”构建步骤中删除单个文件,因为我将所有资源作为文件夹引用导入。 我需要它来维护资源目录中的目录结构。
我该如何解决这个问题? 任何建议或想法将不胜感激!
I am developing an iPhone app and there will be a Full as well as a Lite version of that app. In order get both bundles from the same source code and Xcode project I added another target to the Xcode project.
Now, I want to have the Lite target copy only a subset of the resource files to the bundle. But, Xcode won't simply let me delete individual files from the "Copy Files to Bundle" build step, since I imported all my resources as folder references. I need this in order to maintain a directory structure in the resources directory.
How do I solve this problem? Any suggestions or ideas are greatly appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 Xcode 的左侧面板中,右键单击顶部的“组和文件”栏。 检查“目标会员”。
现在,您将看到当前构建目标中应包含的每个文件都有一个勾号。 取消勾选您不需要的目标,切换到其他目标,然后重复。
In the left-hand panel of Xcode, right-click on the "Groups & Files" bar at the top. Check "Target Membership".
Now you'll see a tick against every file that should be included in your current build target. Untick the ones you don't want, switch to your other target, and repeat.
您可以右键单击资源文件或组(文件夹),选择“获取信息”,然后有选择地将内容从信息窗口的“目标”选项卡下的 Lite 版本中保留,而不用操作目标的“复制捆绑资源”步骤对于您选择的文件。 在组(文件夹)上执行此操作会递归更改,因此使用资源组(文件夹)是为单独的构建创建单独的资源集合的一种很好的简单方法。
Instead of manipulating the "Copy Bundle Resources" step of your target, you can right-click resource files or groups (folders), choose "Get Info," and selectively leave stuff out of your Lite build under the Targets tabs of the info window for the file(s) you selected. Doing this on a group (folder) recurses the changes, so using resource groups (folders) is a nice easy way to make separate resources collections for separate builds.