如何在自定义Xcode项目模板中创建或定义新目标 [英] How to create or define a new target in a custom Xcode project template

查看:143
本文介绍了如何在自定义Xcode项目模板中创建或定义新目标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

TL; DR:我在添加到TemplateInfo.plist文件中的XML片段是什么,在创建新的Xcode项目时创建第二个编译器目标?



在我自己的Xcode项目模板上工作时,我正在尝试。如果你想看看我在用KIF做什么(即使对于这个问题的答案,这不是必要的),看看 KIF Integrations.xctemplate 文件夹。

解决方案

如果我理解你的问题......



自动复制Build Target而不手动创建一个新的设置它选择你要复制的那个并按CMD + D






(关于如何做同样事情的说明但是(更可能的)构建方案(对于想知道这个问题的未来用户)如下:



在xCode中点击产品(顶部栏...从文件对面,编辑,查看等)然后在下拉菜单的底部单击新方案。



要复制您的方案(如您所建议),请单击埃德它是Scheme而不是New Scheme,然后点击Duplicate Scheme


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?

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. KIF requires you to duplicate your regular target and then modify some properties. 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?

Have a look at the template project over at my github repository. 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.

解决方案

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


(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".

To duplicate your scheme (like you suggested) click "Edit Scheme" instead of "New Scheme" then click "Duplicate Scheme"

这篇关于如何在自定义Xcode项目模板中创建或定义新目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆