简体   繁体   English

如何在自定义Xcode项目模板中创建或定义新目标

[英]How to create or define a new target in a custom Xcode project template

TL;DR: What XML snippets do I add to my TemplateInfo.plist files, to create a second compiler target when creating a new Xcode project? TL; DR: 我在我的TemplateInfo.plist文件中添加了哪些XML片段,在创建新的Xcode项目时创建第二个编译器目标?

While working on my own Xcode project template, I'm trying to have KIF integration testing working in a 'out of the box' sort of way. 在处理我自己的Xcode项目模板时,我正试图让KIF集成测试以“开箱即用”的方式运行。 KIF requires you to duplicate your regular target and then modify some properties. KIF要求您复制常规目标 ,然后修改某些属性。 This is normally done manually, but it both takes time and leaves a margin for error, while it's so mundane it could be automated. 这通常是手动完成的,但它既需要时间又会留下误差,而它可以实现自动化。

For clarity, I'm looking to create the second target in this screenshot automatically : 为清楚起见,我希望自动在此屏幕截图中创建第二个目标

手动复制后的屏幕截图

I got quite far with the whole template customization, but I just can't figure out how to create another target, even though the templates create one for unit testing if you hit that checkbox. 我对整个模板定制做了很多,但我无法弄清楚如何创建另一个目标,即使模板创建一个用于单元测试,如果你点击该复选框。 How does Apple do that ? Apple如何做到这一点

Have a look at the template project over at my github repository . 在我的github存储库中查看模板项目 If you want to see what I'm doing with KIF (even though for the answer of this question this is should not be necessary), have a look at the plist in the KIF Integrations.xctemplate folder. 如果你想看看我正在用KIF做什么(即使对于这个问题的答案,这不是必需的),请查看KIF Integrations.xctemplate文件夹中的plist。

If I understand your question correctly... 如果我理解你的问题......

To duplicate the Build Target automatically without manually creating a new one and setting it up select the one you want to duplicate and press CMD+D 要自动复制构建目标而不手动创建新目标并进行设置,请选择要复制的目标并按CMD + D.


(Instructions on how to do the same things but with (the more likely) build schemes (for future users who wonder to this question) are below: (关于如何做同样的事情但有(更可能的)构建方案(对于想知道这个问题的未来用户)的说明如下:

In xCode click Product (top bar... across from File, Edit, View, etc.) and then at the bottom of the drop-down menu click "New Scheme". 在xCode中单击产品(顶部栏...从文件,编辑,视图等对面),然后在下拉菜单的底部单击“新建方案”。

To duplicate your scheme (like you suggested) click "Edit Scheme" instead of "New Scheme" then click "Duplicate Scheme" 要复制您的方案(如您所建议),请单击“编辑方案”而不是“新方案”,然后单击“复制方案”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何为现有项目自动创建新的xcode目标 - How to create new xcode target automatically for existing project 如何使用Xcode 9.x在自定义项目模板中添加“带有文件夹的新组”? - How to add “New Group with Folder” in custom project template by using Xcode 9.x? 如何为Xcode 6创建自定义Swift文件模板? - How to create a custom Swift File template for Xcode 6? 在xcode的自定义项目模板中创建物理存在文件夹 - Create physical existence folder in Custom project Template of xcode 如何使用 CMake 在 Xcode 中为应用程序扩展创建新目标? - How to create the new target in Xcode for app extension using CMake? 如何使用New> File…模板“向导”在Xcode 6中创建UITableViewController - How to create UITableViewController in Xcode 6 using New>File… template “wizard” 带有自定义项目模板的 Xcode 9 文件夹引用 - Xcode 9 folder references with custom project template xcode项目中如何获取最小部署目标 - How to get the minimum deployment target in the xcode project 创建新的xcode项目时找不到基于phonegap的项目模板 - No phonegap based project template found while creating new xcode project 使用现有的包名称创建新的XCode项目 - Create New XCode Project With Existing Package Name
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM