为什么我在 Xcode 中看不到托管对象类文件模板?

发布于 2024-08-19 07:29:12 字数 155 浏览 4 评论 0 原文

我在 Xcode 中创建了一个 .xcdatamodel 托管对象模型文件。我在“组和”中选择了该文件文件。然后我转到“文件”>“新...>>在 iPhone 模板/Cocoa Touch 类模板中,我没有看到“托管对象类”文件模板。

有谁知道可能出了什么问题?

I created a .xcdatamodel Managed Object Model file in Xcode. I selected that file in Groups & Files. Then I go to File > New... > and nowhere in the iPhone Templates / Cocoa Touch Class templates I see the "Managed Object Class" file template.

Does anyone know what can be wrong?

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

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

发布评论

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

评论(6

谎言 2024-08-26 07:29:12

我通常还需要选择要为其生成类文件的实体。

I usually need to also select the entities for which I want to generate the class files.

凌乱心跳 2024-08-26 07:29:12

在 Xcode 4 中,选择 xcdatamodeld 中的实体,然后选择 Editor Menu >创建 NSManagedObject 子类

In Xcode 4, select the entity in the xcdatamodeld, then choose Editor Menu > Create NSManagedObject Subclass

逆夏时光 2024-08-26 07:29:12

如果您想子类化 NSManagedObject 那么我强烈建议您看看 mogenerator (github)。它会自动为您生成子类,并在您更新模型时使它们保持同步。它还具有机器类与人类类的概念,以便您可以添加方便的方法等,而无需每次更新模型时都踩踏您的代码。

If you are wanting to subclass NSManagedObject then I would highly recommend talking a look at mogenerator (github). It will autogenerate the subclasses for you AND keep them in sync as you update your model. It also has the concept of machine classes vs. human classes so that you can add convenience methods, etc. without your code being stepped on each time you update your model.

像极了他 2024-08-26 07:29:12

我以前也见过这个问题。对我来说,解决方案是单击非数据模型文件(在“组和文件”中),然后单击返回版本化数据模型文件(及其中的实体),然后尝试“文件”->“文件”。新文件。或者,重新启动 xcode,选择数据模型文件(及其中的实体),然后尝试 File ->新文件也对我有用。

I've seen this problem before as well. Solution for me was to click on a non-data model file (in Groups & Files) and then click back on the versioned data model file (and entity within it) and then try File -> New File. Alternatively, restarting xcode, selecting the data model file (and entity within it) and then trying File -> New File also worked for me.

话少心凉 2024-08-26 07:29:12

单击左上角的“Simulator 3.1.2 | debug”。将其更改为“IPHONE Device 3.1.2 (BASE SDK)...瞧。(SAMS iphone in 24hrs?大量拼写错误和不完整的程序!)

Click On the top left where it says "Simulator 3.1.2 | debug". Change it to "IPHONE Device 3.1.2 (BASE SDK)... voila. (SAMS iphone in 24hrs?? lots of typos and incomplete procedures!)

俯瞰星空 2024-08-26 07:29:12

托管对象类文件模板可以在 XCode 4 的新文件创建选项的“核心数据”部分中看到。
下面的屏幕截图描述了它。

NSManagedObject 子类模板

谢谢,
亲开发者。

Managed Object Class file template can be seen under "Core Data" section of new file creation option of XCode 4.
The following screenshot depicts it.

NSManagedObject subclass template

Thanks,
prodeveloper.

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