Xcode 自定义项目模板仅创建对文件的引用

发布于 2024-08-28 11:56:27 字数 424 浏览 3 评论 0原文

我尝试创建一个自定义项目模板来设置单元测试。

问题是,当我基于此模板创建新项目时,它会创建对模板文件的引用:

当我编辑文件时,它会更改我的模板文件而不是我的实际项目文件! 当我删除模板时,实际项目中的文件变成红色!

项目模板位于:

/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Project Templates/Application/Test-based Application

中安装我的模板项目

阅读有关堆栈溢出的一些问题我尝试在/Library/Application Support/ 开发人员/共享/Xcode/项目模板

但是当我创建新项目时我看不到我的模板。

有人可以帮忙吗?

谢谢, 文森特

I tried to create a custom project template for setting up unit testing.

The problem is that when i create a new project based on this template it creates references to the template files :

When i edit a file, it changes my template files instead of my actual project files !
When i delete my template, files from my actual project becomes red !

The project template is in :

/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Project Templates/Application/Test-based Application

Reading some question on stack overflow i tried to install my template project in

/Library/Application Support/Developer/Shared/Xcode/Project Templates

But i cannot see my template when i create a new project.

Can anybody help ?

Thanks,
Vincent

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

写给空气的情书 2024-09-04 11:56:27

您可能对我在 GitHub 上的 Xtemplate 项目感兴趣。这是一个简单的脚本,将设置一个具有适当默认值的新 Xcode 项目,它具有使用 OCMock 的单元测试目标。

You might be interested in my Xtemplate project on GitHub. It’s a simple script that will set up a new Xcode project with decent defaults, it features a unit testing target with OCMock.

心在旅行 2024-09-04 11:56:27

有几个原因,但最重要的是因为您的模板信息 plist 标识符不是唯一的!正如您所说,您已将模板放入 /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Project Templates/Application/Test-based Application 中
然后将相同的模板移到其他地方。 xcode 已在第一个位置看到标识符号并忽略第二个位置。更改标识符并尝试一下。
为什么不尝试主模板文件夹:library/developer/xcode/templates ?

there are several reasons but the most important is because your template info plist identifier is not unique! as you said you have put the template in /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Project Templates/Application/Test-based Application
and then moved the same template in other place. xcode has seen the identifier number in the first location and ignores the second. change the identifier and give it a try.
why dont you try the main template folder:library/developer/xcode/templates ?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文