[英]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.